note 55873 added to function.array-walk
| From: | alexATpassantDOTorg at osu1 dot php dot net | Date: | Tue, 16 Aug 2005 10:59:23 +0000 |
| Subject: | note 55873 added to function.array-walk | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93721@lists.php.net to get a copy of this message | ||
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);
}
----
Manual Page -- http://www.php.net/manual/en/function.array-walk.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55873
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55873&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55873&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55873&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55873&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55873&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55873&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55873&report=yes
Search -- http://master.php.net/manage/user-notes.php