Wednesday, August 25, 2010

PHP Big Bummer!

When a string is set to empty String "":
--------------
$myvar = "";
echo is_null($myvar) ? "is null" : "not null";
//return not null
echo $myvar==null ? "is null" : "not null";
//return IS NULL
//whattttt????
=========
When a array is set to empty String "":
$myvar = array("myname" => "");
echo is_null($myvar["myname"]) ? "is null" : "not null";
//return not null
echo isset($myvar["myname"]) ? "is set" : "not Set";
//return NOT SET!
//whatttttt????
echo $myvar["myname"] == null ? "is null" : "not null";
//return IS NULL!
//what??????????

No comments: