Posted By

pruntrut on 05/14/12


Tagged

php array arraymap


Versions (?)

Using array_map() on multidimensional arrays


 / Published in: PHP
 

URL: http://stackoverflow.com/questions/4085623/array-map-for-multidimensional-arrays

Using array_map() on multidimensional arrays

  1. $array = array( array('A' => "Hello", 'B' => "World"),
  2. array('A' => "Goodnight", 'B' => "Vienna")
  3. );
  4.  
  5. function myFunc(&$item, $key) {
  6. $item = mysql_real_escape_string($item);
  7. }
  8.  
  9. array_walk_recursive($array,'myFunc');
  10.  
  11. var_dump($array);

Report this snippet  

You need to login to post a comment.