I've realized that, although most of my experience consists in writing PHP applications, I find myself making "beginner mistakes" from time to time. This because PHP is a language that has grown very organically and as such has some idiosyncrasies, quirks and pitfalls that I don't know about.
I'd like this question to be a wiki for all those who want to know PHP's pitfalls and exceptions from what we might believe are the rules. But please, don't write general responses like:
Some functions receive arguments as
$needle
,$haystack
, while some as$haystack
,$needle
.
Tell the function names. You have a few answers from me as examples. Oh, and add one pitfall per answer. This way we'll see which is the most despised of them all (by voting).
I don't want to start a flame war, keep it to the subject. If you'd like to write some bad things about PHP then do it as a comment to the respective answer.
Hopefully this wiki will be of help for all of us, beginners and experts.
Update:
After Andrew Moore's comment I'm thinking that the answer should also contain a solution or workaround for the pitfall.