note 43336 deleted from function.array-walk by aidan
| From: | aidan@php.net | Date: | Sun, 11 Jul 2004 02:07:00 +0000 |
| Subject: | note 43336 deleted from function.array-walk by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73020@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Easy way of applying array_walk() recursively:
function fix_urls(&$data) {
if (is_array($data)) {
array_walk($data, 'fix_urls');
} else {
$data = addslashes(trim($data));
}
}
fix_urls($inital_array);
This is just a specific example that I needed for a little project, but you can apply the same
method to anything.