Solved

Php code help needed

Posted on 2008-10-07
4
180 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
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 108

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now