The other major difference with echo is that print returns a value, even it’s always 1.
That might not look like much, but you can use print in another expression. Here are some examples:
<?php
rand(0,1) ? print 'Hello' : print 'goodbye';
print PHP_EOL;
print 'Hello ' and print 'goodbye';
print PHP_EOL;
rand(0,1) or print 'whatever';
?>
Here’s a more serious example:
<?php
function test() {
return !!rand(0,1);
}
test() or print 'failed';
?>