note 113307 added to function.array-filter
| From: | tomasz at trejderowski dot pl | Date: | Tue, 24 Sep 2013 08:16:20 +0000 |
| Subject: | note 113307 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196367@lists.php.net to get a copy of this message | ||
Read "callback" parameter note with understanding (as well as "converting to
boolean" chapter). Keep in midn, that 0, both:
* integer: 0 and
* float: 0.00
evaluates to boolean FALSE! And therefore all array nodes, that have such value WILL ALSO BE
FILTERED by array_filter(), with default call back. Unless you provide your own callback function,
that will (for example) filter only empty strings and NULLs, but leave "zeros" untouched.
Some people (including me) might be surprised to find this out.
----
Server IP: 69.147.83.199
Probable Submitter: 155.158.96.28
----
Manual Page -- http://php.net/manual/en/function.array-filter.php
Edit -- https://master.php.net/note/edit/113307
Del: integrated -- https://master.php.net/note/delete/113307/integrated
Del: useless -- https://master.php.net/note/delete/113307/useless
Del: bad code -- https://master.php.net/note/delete/113307/bad+code
Del: spam -- https://master.php.net/note/delete/113307/spam
Del: non-english -- https://master.php.net/note/delete/113307/non-english
Del: in docs -- https://master.php.net/note/delete/113307/in+docs
Del: other reasons-- https://master.php.net/note/delete/113307
Reject -- https://master.php.net/note/reject/113307
Search -- https://master.php.net/manage/user-notes.php