1 edb May 25, 2008 23:58
3 yabba May 26, 2008 01:08
Weirdly enough, so is blonde
<?php
echo 'bugger me '.( empty( $blonde ) ? 'I should have known better' : 'it doesn\'t work, no surprises there then :' );
?>
¥
4 blueyed May 26, 2008 01:13
NULL == 0 == false == ''
but:
NULL !== 0 !== false !== ''
Use "===" / "!==" if you also want to check the type of the var.
5 edb May 26, 2008 01:28
Thanks blueyed (and Afwas and ¥åßßå)! I rarely think about === or !== because I'm pretty simple, but yeah lots of the details pages at php.net say to use it for this or that or the other thing.
Cool. So I can leave the table defaulting to NULL and still check it with either == NULL or == '' and expect basically the same results. The first is obviously better so that is what a smart person would do.
NULL is an entity in php also, so you can test on NULL