| Tutorials Main Latest Tutorials Popular Tutorials Top Rated Tutorials |
| Login to See your Favorite Tutorials |
| Description: Some simple ways to output text in php | |
| Version: 1.0 | |
| Added on: 24 February 2007 | |
| Author: unknown | |
| Difficulty Level: Very Easy | |
| Views: 3362 | |
There are several ways to do this, I will list the 3 most common ones.
They are:
echo
print
die
the echo statement basically prints out anything to the screen in html format. This means whatever lies between the echo"" tags will be output to the browser as long as it is NOT a php variable or a html tag.
Example:
| Code: |
|
echo"John is a man, he is 20 years old." |
| Quote: |
|
John is a man, he is 20 years old. |
| Code: |
|
echo"John is a man, he is 20 years old". |
| Quote: |
|
John is a man, he is 20 years old. |
| Code: |
|
print("John is a man, he is 20 years old"); |
| Quote: |
|
Outputs John is a man, he is 20 years old. |
| Code: |
|
die("John is a man, he is 20 years old"); echo"John is a man, he is 20 years old, this is a second message"; |
| Quote: |
|
John is a man, he is 20 years old , and it will neglect the next lines of code. |