Solved

Php code help needed

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

726 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