PHP aaaaarrrrrggggghhhhhh

Things I hate about PHP No. 512 (notwithstanding the fact that in comparison to many other things I like PHP):

Inconsistency in parameter ordering

Say I want to find a small thing in a big thing, like a piece of a string in a bigger string. I can use strpos and you pass in the string you’re looking in first, and the string you want to find second. So strpos(“PHP aaaarrrgggh”,”PHP”) returns 0 (or false, unless you’re using ===, but I’m sure that’s been ranted about enough).

But if I want to find, for example, a key in an array I pass in the key I’m looking for first and the thing to look in second. So I have to remember the exact syntax of every single miniscule stupid little command and which order to pass parameters in because there’s absolutely no consistency.

Leave a Reply

Your email address will not be published. Required fields are marked *