[wp-hackers] Options and caching

Otto otto at ottodestruct.com
Wed Jan 30 15:39:55 GMT 2008


On Jan 30, 2008 7:08 AM, Rob Miller <r at robm.me.uk> wrote:
> On Jan 30, 2008 10:27 AM, Ozh <ozh at planetozh.com> wrote:
> > First thing:
> > get_option('doesnotexist') returns false, not an empty string.
>
> <?php
> var_dump(false == ""); // bool(true)
> ?>

<?php
var_dump(false === ""); // bool(false)
?>

Yes, "" == false. But it's still returning false, not "", so he should
be checking for identity, not equality.

Equality is trickier than identity because it uses the casting of types.

"" == false == 0 == "0" == null // all of these are true

"+010" == "10.0" // this is true too

-Otto


More information about the wp-hackers mailing list