Difference Between echo & Print in PHP

I searched for ‘difference between echo and print in php’, but got different answer with different logics. Here is what I understood after reading different blogs, and tutes. Basically both keywords echo and print work same. they give output to the user, but there are some minor differences as follows:

echo print
gives no return value. gives return value i.e. 1(one)
It can’t be used in expression, because it doesn’t return any value. can be used in expression, because it returns value.

For example, if you write echo print 1;

you’ll get the result: 11

It can take multiple parameters.

For example:

echo "This ", "string ", "was ", "made ", "with multiple parameters.";

It can take only one parameter.
It’s faster It’s slower

Leave a Reply