• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Php code help needed

How do I print in php

in asp it is response.write how is it in php
0
eteran
Asked:
eteran
1 Solution
 
glcumminsCommented:
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
 
Ray PaseurCommented:
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
 
wktang83Commented:
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
 
Loganathan NatarajanLAMP DeveloperCommented:
echo is used to print the output to the user like in asp response.write




0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now