“0″ is not Empty
PHP offers a nifty thing called “silent type conversion” which allows data of different types to be easily compared with data of different types. This is cool because I can say that the integer 1 and the boolean true can be evaluated to be the same thing. This becomes interesting when the concept of “emptiness” comes into play.
In my head, it makes perfect sense to say that a string zero characters in length and an array with no values are both empty. Likewise, the integer 0 can also be evaluated as an empty value too. That makes total sense.
What doesn’t make sense is that PHP considers a 1 character long string with a value of “0″ to be empty.
I’m sorry — that’s complete bullshit.
After witnessing a philosophical holy war unfold on the internals list over PHP 6’s namespace operator, I’m surprised that something this ridiculous made it into userland.
Comments are closed. Sorry.