Clan Adverts

Sponsors

Latest Product

User Box

Anonymous
54.205.189.156
Nickname:

Password:

Security Code
Security Code
Type Security Code


Scripts Used Here

  • ThumbsUp
  • jQuery Social Share
  • 3S Caching System (Cache API results and PHP data)
  • siteFeature
  • jQuery Social Media Tabs
  • HoverAlls v2.5

Text to screen

Description: Some simple ways to output text in php
Version: 1.0
Added on: 24 February 2007
Author: unknown
Difficulty Level: Very Easy
Views: 11023
Rating: 10.0 (1 Vote)
Detailed Profile View Comments (1)

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:


This outputs
Quote:

John is a man, he is 20 years old.


With tags,
Code:


This outputs
Quote:

John is a man, he is 20 years old.


Print works similar to echo.

Example:
Code:


Quote:

Outputs John is a man, he is 20 years old.


Die is different however, it prints text to the screen, but then it kills the PHP operation after it is done.

Example:
Code:


This will only output
Quote:

John is a man, he is 20 years old
, and it will neglect the next lines of code.

Comments powered by Disqus