• 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
1 Solution
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:

print "Some text";
echo "Some more text";

Open in new window

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
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:

Loganathan NatarajanLAMP DeveloperCommented:
echo is used to print the output to the user like in asp response.write


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