I am aware of array_walk() and array_map(). However when using the former like so (on an old project) it failed
array_walk($_POST,
It's because the mysql_real_escape_string is being given two parameters, both string.
http://php.net/manual/en/function.mysql-real-escape-string.php
http://www.phpbuilder.com/manual/en/function.array-map.php:
array_map() returns an array containing all the elements of arr1 after applying the callback function to each one. The number of parameters that the callback function accepts should match the number of arrays passed to the array_map()
you could do
function myescape($val)
{
return mysql_real_escape_string($val);
}
... then
array_walk($_POST, 'myescape');