+ 3

What is the difference between "echo" and "print"?

24th Jul 2016, 3:10 PM
$machitgarha
$machitgarha - avatar
2 Answers
+ 2
print returns values, while echo returns void and in some books I also read that print is little bit slower than echo
26th Jul 2016, 11:46 AM
abhijit kumbhar
abhijit kumbhar - avatar
+ 2
Hey! I found it! They have a small difference: Print returns value always, but it's not right about echo. This code works: $printSuccess = print "Hello world!"; //$printSuccess = 1 This code does not work: $echoSuccess = echo "Hello world!"; //Parse error
24th Jul 2016, 8:06 PM
$machitgarha
$machitgarha - avatar