note 115949 added to function.array-filter
| From: | m dot abbasian at outlook dot com | Date: | Sat, 18 Oct 2014 08:58:46 +0000 |
| Subject: | note 115949 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200675@lists.php.net to get a copy of this message | ||
If you want a quick way to Find Numbers ( remove NULL, FALSE and Empty Strings (""), all
Strings) but leave values of 0 (zero)
eg:
<?php
/*
Find Numbers (removes all NULL, FALSE and Empty Strings, all Strings) but leaves 0 (zero) values
*/
$result = array_filter( array( "0",0,1,2,3,'text' ) , 'is_numeric' );
var_dump($result);
/*
array (size=5)
0 => string '0' (length=1)
1 => int 0
2 => int 1
3 => int 2
4 => int 3
*/
?>
----
Server IP: 72.52.91.14
Probable Submitter: 80.250.199.186
----
Manual Page -- http://php.net/manual/en/function.array-filter.php
Edit -- https://master.php.net/note/edit/115949
Del: integrated -- https://master.php.net/note/delete/115949/integrated
Del: useless -- https://master.php.net/note/delete/115949/useless
Del: bad code -- https://master.php.net/note/delete/115949/bad+code
Del: spam -- https://master.php.net/note/delete/115949/spam
Del: non-english -- https://master.php.net/note/delete/115949/non-english
Del: in docs -- https://master.php.net/note/delete/115949/in+docs
Del: other reasons-- https://master.php.net/note/delete/115949
Reject -- https://master.php.net/note/reject/115949
Search -- https://master.php.net/manage/user-notes.php