note 103056 modified in function.array-walk by danbrown
| From: | danbrown@php.net | Date: | Wed, 23 Mar 2011 15:47:11 +0000 |
| Subject: | note 103056 modified in function.array-walk by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178136@lists.php.net to get a copy of this message | ||
I was looking for trimming all the elements in an array, I found this as the simplest solution:
<?php
array_walk($ids, create_function('&$val', '$val = trim($val);'));
?>
--was--
I was looking for trimming all the elements in an array, I found this as the simplest solution:
array_walk($ids, create_function('&$val', '$val = trim($val);'));
http://php.net/manual/en/function.array-walk.php