note 102524 added to language.types.null
[email protected] Fri, 18 Feb 2011 15:31:03 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
In reply to poutri_j's post (albeit old) about an empty array() == NULL. It's not that an empty array is considered null, its that both are considered FALSE in a comparison. So: <?php $array = array(); if($array==NULL) echo '$array == NULL'; # Echos if($array===NULL) echo '$array === NULL'; # Doesn't echo. ?> This is as expected and something that all newcomers should pick up on. Link to PHP's great reference on comparisons: http://php.net/manual/de/types.comparisons.php ---- Server IP: 69.147.83.197 Probable Submitter: 74.94.28.33 ---- Manual Page -- http://www.php.net/manual/en/language.types.null.php Edit -- https://master.php.net/note/edit/102524 Del: integrated -- https://master.php.net/note/delete/102524/integrated Del: useless -- https://master.php.net/note/delete/102524/useless Del: bad code -- https://master.php.net/note/delete/102524/bad+code Del: spam -- https://master.php.net/note/delete/102524/spam Del: non-english -- https://master.php.net/note/delete/102524/non-english Del: in docs -- https://master.php.net/note/delete/102524/in+docs Del: other reasons-- https://master.php.net/note/delete/102524 Reject -- https://master.php.net/note/reject/102524 Search -- https://master.php.net/manage/user-notes.php