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;
print $var;
Result:
Learn PHP print
If you like this please Link Back to this article...
0 comments:
Post a Comment