Solved

Php code help needed

Posted on 2008-10-07
4
185 Views
Last Modified: 2012-05-05
How do I print in php

in asp it is response.write how is it in php
0
Comment
Question by:eteran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 24

Accepted Solution

by:
glcummins earned 500 total points
ID: 22660366
If you mean "print to a printer", you don't. PHP is primarily designed to generate HTML, and you will be able to print the HTML output via your browser as normal.

If you mean, how do you display text, you can use the "print" or "echo" commands:

<?php
 
print "Some text";
 
echo "Some more text";
 
?>

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 22660436
There is a very good resource on the php.net web site - it is all the manual pages with user comments.  Have a look at this example: http://us3.php.net/manual/en/function.echo.php

HTH, ~Ray
0
 
LVL 3

Expert Comment

by:wktang83
ID: 22660580
Also, if you want to output formatted string (such as floating values with a number of decimal digits), you can use this useful function -- printf:

http://us3.php.net/manual/en/function.printf.php
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 22660691
echo is used to print the output to the user like in asp response.write




0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question