note 55873 deleted from function.array-walk by victor
| From: | victor@php.net | Date: | Tue, 16 Aug 2005 11:30:54 +0000 |
| Subject: | note 55873 deleted from function.array-walk by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93722@lists.php.net to get a copy of this message | ||
Note Submitter: alex AT passant DOT org
----
Here's a function you can get if you want to use a PHP function that will be applied to each
array value (and not key/value pair) in an array_walk
eg: array_values_walk(array(' foo', ' bar '), trim) ==>
array('foo','bar');
function array_values_walk(&$array, $function) {
$lambda =
create_function('&$value,$key','$value='.$function.'($value);');
array_walk($array, $lambda);
}