Why I hate PHP
echo (0 == null); => 1
@#$%@*@*%@#!
To those unfamiliar with PHP, 1 stands for true in PHP. Apparently, I’m not alone in my hatred.
echo (0 == null); => 1
@#$%@*@*%@#!
To those unfamiliar with PHP, 1 stands for true in PHP. Apparently, I’m not alone in my hatred.
This entry was posted on Monday, December 25th, 2006 at 8:27 pm and is filed under php, programming, rant. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Paul Goscicki is proudly powered by
WordPress
Entries (RSS)
and Comments (RSS).
December 26th, 2006 at 10:26 am
I think you need to use === (identity check) for that. Sill, I have no clue why would need to 0 be equal to null… I wonder if this is a bug or a feature.
I guess to it’s best to use is_null() to avoid the PHP comparison oddities in situations such as this one.
December 26th, 2006 at 11:06 am
I got around it by using !is_int().
December 7th, 2008 at 10:25 am
Never figured out this language although many guys I know say it is very easy. Not for me though