+ 1
What is the difference between echo and print in PHP??
🏵🌼💐🌸💮💐🌻🌸💐
2 Respuestas
+ 5
echo
Outputs one or more strings separated by commas
No return value
e.g. echo "String 1", "String 2"
print
Outputs only a single string
Returns 1, so it can be used in an expression
e.g. print "Hello"
or, if ($expr && print "foo")
+ 2
They are both used to output data to the screen. The differences are small:echo has no return value while printhas a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print .