note 112956 added to function.array-filter
| From: | keksnicoh at googlemail dot com | Date: | Mon, 12 Aug 2013 11:01:29 +0000 |
| Subject: | note 112956 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195937@lists.php.net to get a copy of this message | ||
Usefull invertation of array_filter
<?php
$data = array(...)
$noArrayData = array_filter_inverse($data, 'is_array');
/**
* Inverts the result of the filter callback.
* @param array $data
* @param callable $f
* @return array
*/
function array_filter_inverse(array $data, callable $f)
{
return array_filter($data, function() use(&$f) {
return ! call_user_func_array($f, func_get_args());
});
}
?>
----
Server IP: 212.124.37.9
Probable Submitter: 212.12.46.3
----
Manual Page -- http://php.net/manual/en/function.array-filter.php
Edit -- https://master.php.net/note/edit/112956
Del: integrated -- https://master.php.net/note/delete/112956/integrated
Del: useless -- https://master.php.net/note/delete/112956/useless
Del: bad code -- https://master.php.net/note/delete/112956/bad+code
Del: spam -- https://master.php.net/note/delete/112956/spam
Del: non-english -- https://master.php.net/note/delete/112956/non-english
Del: in docs -- https://master.php.net/note/delete/112956/in+docs
Del: other reasons-- https://master.php.net/note/delete/112956
Reject -- https://master.php.net/note/reject/112956
Search -- https://master.php.net/manage/user-notes.php