function arrayMap($callback, array $array, $keys = null) { foreach ($array as $key => $val) { if (Arrays::is($val)) { $array[$key] = arrayMap($callback, $array[$key]); } elseif (!Arrays::is($keys) || Arrays::in($key, $keys)) { if (Arrays::is($callback)) { foreach ($callback as $cb) { $array[$key] = call_user_func($cb, $array[$key]); } } else { $array[$key] = call_user_func($callback, $array[$key]); } } } return $array; }
function trataPost($post) { $post = arrayMap('utf8_decode', $post); $post = arrayMap('trataPostVazio', $post); //$post = arrayMap('htmlspecialchars', $post); $post = arrayMap('strip_tags', $post); return $post; }