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 | |
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 you’ll get the result: |
It can take multiple parameters.
For example:
|
It can take only one parameter. |
It’s faster | It’s slower |