xxxxxxxxxx
echo and print Both are used to output data to the screen.
The only differences are as follows:
echo: does not return a value, little bit faster than print
print: return a value of 1.
echo: can accept multiple parameters (although such usage is rare)
Eg: echo 'This ','string ','was ','made ','with multiple parameters.';
print: can only take a single argument.
xxxxxxxxxx
Source link:
https://www.programmingquest.com/2019/04/difference-between-echo-and-print.html
1. echo Statement
* we can write echo statement with parenthesis like 'echo()' or without parenthesis 'echo'.
* In the echo we can pass multiple variable in comma separated form to see the output like 'echo $a,$b,$c;'
* echo doesn’t return any value
* echo is faster then print
2. Print Statement
* we can write print statement with parenthesis like 'print()' or without parenthesis 'print'.
* In the print we can not pass multiple variable in comma separated form like echo.
* print statement always returns 1.
* print is slower than echo
xxxxxxxxxx
echo and print are more or less the same.
They are both used to output data to the screen.
The differences are small:
1- echo has no return value
while print has a return value of 1 so it can be used in expressions.
2- echo can take multiple parameters (although such usage is rare)
while print can take one argument.
3- echo is marginally faster than print.