note 124349 added to function.is-array
| From: | MikeF@php.net | Date: | Mon, 28 Oct 2019 16:24:54 +0000 |
| Subject: | note 124349 added to function.is-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212865@lists.php.net to get a copy of this message | ||
While this is implied in the definition I have verified (PHP 5.5.38, 7.1.32, 7.2.23 and 7.3.10)
that:
is_array(null) == false
So there is no need for this:
if (isset($arr) && is_array($arr)) { /* ⦠*/ }
The same can be accomplished with:
if (is_array($arr)) { /* ⦠*/ }
The value null is often a special case so I think this should be included in the documentation.
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.168 (proxied: 80.133.227.89)
----
Manual Page -- http://php.net/manual/en/function.is-array.php
Edit -- https://master.php.net/note/edit/124349
Del: integrated -- https://master.php.net/note/delete/124349/integrated
Del: useless -- https://master.php.net/note/delete/124349/useless
Del: bad code -- https://master.php.net/note/delete/124349/bad+code
Del: spam -- https://master.php.net/note/delete/124349/spam
Del: non-english -- https://master.php.net/note/delete/124349/non-english
Del: in docs -- https://master.php.net/note/delete/124349/in+docs
Del: other reasons-- https://master.php.net/note/delete/124349
Reject -- https://master.php.net/note/reject/124349
Search -- https://master.php.net/manage/user-notes.php