note 111091 added to function.array-filter
| From: | Anonymous | Date: | Sun, 13 Jan 2013 17:52:09 +0000 |
| Subject: | note 111091 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193013@lists.php.net to get a copy of this message | ||
If you want a quick way to remove NULL, FALSE and Empty Strings (""), but leave values of
0 (zero), you can use the standard php function strlen as the callback function:
eg:
<?php
// removes all NULL, FALSE and Empty Strings but leaves 0 (zero) values
$result = array_filter( $array, 'strlen' );
?>
----
Server IP: 192.41.42.26
Probable Submitter: 117.53.84.123
----
Manual Page -- http://php.net/manual/en/function.array-filter.php
Edit -- https://master.php.net/note/edit/111091
Del: integrated -- https://master.php.net/note/delete/111091/integrated
Del: useless -- https://master.php.net/note/delete/111091/useless
Del: bad code -- https://master.php.net/note/delete/111091/bad+code
Del: spam -- https://master.php.net/note/delete/111091/spam
Del: non-english -- https://master.php.net/note/delete/111091/non-english
Del: in docs -- https://master.php.net/note/delete/111091/in+docs
Del: other reasons-- https://master.php.net/note/delete/111091
Reject -- https://master.php.net/note/reject/111091
Search -- https://master.php.net/manage/user-notes.php