+3  A: 

This blog post has explored this question to a greater depth than you may have even known was possible.

Jesse Dhillon
Extraordinary stupid article.
Col. Shrapnel
@Col Must've had his feelings hurt because of getting the "interview question for the PHP developer who thinks they’re hot shit" wrong. One of the most arrogant and clueless posters on PHP on this site.
pessimopoppotamus
+1  A: 

Two differences:

print has a return value, echo doesn't. Therefore print is slightly slower but may be used in function context.

echo accepts multiple arguments. So you may write echo $a, $b instead of echo $a . $b. The former one will be faster, because the strings are echoed directly, without the necessity of first copying them to a new chunk of memory.

Concerning the parentheses: They are simply wrong in my eyes. They have no function at all. You could as well write echo (((((((((($a)))))))))); it is simply stupidity and/or ignorance. Furthermore it increases the chance of misinterpretation. For example print("foo") && print("bar") does not print foobar, because PHP interprets this as print(("foo") && print("bar")). So bar1 would be printed, even though it looks different.

nikic
I know Python is not PHP, but they [banned](http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function) the use of `print 'something'`, now you always have to use `print('something')` with the parentheses.
pessimopoppotamus
Also see: http://www.ideone.com/LUOOG
pessimopoppotamus
No. It does make a difference. Even though it outputs the same the version with parentheses *looks* different. The parentheses and function like formatting make it look different. At least I would be fooled into thinking that it outputs `foobar`, if I didn't stop to think about it.
nikic
Yes, you are right, it outputs the same thing. Maybe I didn't explain my point clearly. I'm talking about the understandability of the code, not of the functionality. The functionality doesn't change, that's correct.
nikic
Though there actually is one case, there using parentheses will not only make the code less understandable, but will actually break things. If you have a function which returns by reference `return($a)` will not work, because it will not return a reference to `$a`, but the result of the expression `($a)`, which obviously is a value, not a reference. But this is off topic, because we're talking about print and echo ^^
nikic
@nik Do elaborate. I can't see how it would be different
pessimopoppotamus
@nik the part about references
pessimopoppotamus
Simply see the third note on http://php.net/return. It is explained there.
nikic
A: 

No difference at all.

Col. Shrapnel
Downvoting this because of a) you are wrong b) extraordinarily stupid comment on a great article
pessimopoppotamus
He's got a point that the article isn't of great importance to any reasonable developer (premature optimization is the root of all evil, we know that ^^). But this answer is simply wrong, -1.
nikic
@nik Those who don't know, and most importantly **don't care** about the code underneath are doomed to write shitty programs
pessimopoppotamus
@pessimopoppotamus well you are who don't really know but only read some stupid articles. I don't blame you because there are a lot of your kind around. I've already got accustomed with ignorant downvotes. It's hard to find a thinking person on SO
Col. Shrapnel
@Col if you are going to serial downvote me, leave a comment with the reason. No need to be a coward.
pessimopoppotamus
@pes That's the problem with PHP, it's so easy a monkey write programs with it. Then we got all these high school kids who think they are hot shit, when they are *just* shit.
quantumSoup
@pess Why not? I'm already a devil in your eyes lol. will it make a difference? :)
Col. Shrapnel
@nikic in the *real life* there is no difference. But for one who want to feel self-important - there, sure, is.
Col. Shrapnel
@Col Nice thinking. I see a bright career at McDonald's for you.
NullUserException
Col, your answer is wrong, the downvotes are perfectly legitimate. Even though you would maybe be right saying that there is no *significant* difference - most is coding standards and preference - saying that it is wrong is simply wrong.
nikic
@NullUserException I hope you would bet some money on this ;)
Col. Shrapnel
Col. Shrapnel
@Jesse You are just wrong. I am one of the little few here who ever curious. And open your eyes, there are thousands ones here, who is asking you to actually optimize your apps with this information.
Col. Shrapnel
Please, could we stop this discussion? And Col, if you haven't noticed, I thing you've got a point (and I think I said that, didn't I?) But your formulation is wrong and it is definitely wrong; I really don't know what you're disagreeing about. If you had written `There is no big difference` I would be okay with it. But your current answer is wrong!
nikic
it was stopped a year ago already lol :)
Col. Shrapnel