by simon baird

Thursday, April 30, 2009

php stupidity

~> cat ~/stupid.php 

$foo = "hello";

if (isset($foo['somekey'])) {
        echo "php is stupid\n";
~> php stupid.php 
php is stupid

Look, I know it's probably doing a $foo[(int)'somekey'] which becomes $foo[0] which does exist. And I now know I should have done is_array($foo) &&... But I don't care right now. This has caused me pain! Boo and :P!!

Beware, my php coding friends.

No comments: