note 43336 added to function.array-walk

From: Date: Thu, 17 Jun 2004 20:13:06 +0000
Subject: note 43336 added to function.array-walk
Groups: php.notes 
Request: Send a blank email to php-notes+get-71256@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.array-walk.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43336 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43336&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43336&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71256) next »