Re: applying one function to all array elements
| From: | Mike Migurski | Date: | Mon, 03 Nov 2003 02:47:41 +0000 |
| Subject: | Re: applying one function to all array elements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168370@lists.php.net to get a copy of this message | ||
>Can someone show me a simple, clean way to apply one function (eg
>stripslashes()) to every element in an array (eg $_POST)?
>
>I've been doing it with a foreach() loop, but there has to be a better
>way. I've also seen http://www.php.net/array_walk, but
>couldn't
>determine how/if it suited my needs.
What part of "Apply a user function to every member of an array" makes it
difficult to assess array_walk's usefulness? If it helps, array_map
("Applies the callback to the elements of the given arrays") does
something similar.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html