PHP Tutorial > String Functions > print
In PHP, print is used to output one or more strings. Even though print behaves like a string function, it is technically not a function, as it doesn't require a parenthesis in its function.
print and echo are very similar in PHP. The one difference is that echo can be used to concatenate string, while print cannot do so.
The syntax of the print construct is:
print 'string'
Let's take a look at the examples below:
Example 1
print 'You are reading a tutorial on PHP print construct.';
Result:
You are reading a tutorial on PHP print construct.
Example 2
$var = 'Learn PHP print';
print $var;
Result:
Learn PHP print
Next: PHP str_replace Function
Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.
More Tutorials: SQL CSS HTML
Copyright 2007-2010 1keydata.com All Rights Reserved. Privacy Policy
|