Hi Guys, What does this function do? function filterData($data){ if(is_array($data)) $data = array_map("filterData", $data); else $data = htmlentities($data, ENT_QUOTES, 'UTF-8'); return $data; } PHP:
It's a simple recursive function to go through an array and convert applicable characters to html entities. If you run the code below it'll give you a better understanding of what's going on, I changed htmlentities() to strtoupper() to give you a better idea. <?php function filterData($data){ if(is_array($data)) $data = array_map("filterData", $data); else $data = strtoupper($data); return $data; } $array = array( 'foo' => array( 'baz' => 'word', 'boo' => array( 'bar' => 'hmm, hey!', 'boo' => 'whats up?', ), ), 'bing' => 'this is lowercase.. but will appear uppercase', ); echo '<pre>'; print_r(filterData($array)); ?> PHP: