Using array_map() on multidimensional arrays


/ Published in: PHP
Save to your folder(s)

Using array_map() on multidimensional arrays


Copy this code and paste it in your HTML
  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);

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.