note 102524 deleted from language.types.null by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Feb 2011 15:36:31 +0000 |
| Subject: | note 102524 deleted from language.types.null by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177138@lists.php.net to get a copy of this message | ||
Note Submitter: contact at mullanaphy dot com
----
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