Posted By

jurius on 06/25/11


Tagged

search array key Value


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tux-world


Search value by key in multidimensional array


 / Published in: PHP
 

  1. function searchArrayValueByKey(array $array, $search) {
  2. foreach (new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key => $value) {
  3. if ($search === $key)
  4. return $value;
  5. }
  6. return false;
  7. }

Report this snippet   <

You need to login to post a comment.