--- Justin French <[EMAIL PROTECTED]> wrote: > Can someone show me a simple, clean way to apply one function (eg > stripslashes()) to every element in an array (eg $_POST)? [snip] > I've also seen http://www.php.net/array_walk, but couldn't > determine how/if it suited my needs.
Maybe you can explain how your need is not met with array_walk()? That would be my suggestion, since it seems to do exactly what you want, but then you mention that you have already looked at it. It does require that the function take two parameters, which isn't the case with stripslashes(). So, you can make a very tiny wrapper function that discards the second parameter (since you don't need it): <? function array_stripslashes(&$var, $key) { $var = stripslashes($var); } array_walk($_POST, 'array_stripslashes'); ?> Hope that helps. Chris ===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php