Hi.....
I know echo() and print() use to display any message but I want to know what is the difference between them ? Please explain with an example ?
Thanks......
Echo and Print in PHP
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Feb 14, 2012, 6:28 AM EST
1. echo can output multiple strings but print can only output a single string.
2. echo has a void return type but print returns an int though it's always 1.
3. echo has a shortcut syntax but print does not.
For example:
echo 'Hello', ' ', 'World';
print 'Hello World';
Vineet Kumar SainiRank #257 · 9.8K reputationPosted Feb 14, 2012, 12:13 PM EST