Skip to content

Instantly share code, notes, and snippets.

@ergunozyurt
Last active October 12, 2015 03:11
Show Gist options
  • Select an option

  • Save ergunozyurt/94f32b32a1aa018c0b76 to your computer and use it in GitHub Desktop.

Select an option

Save ergunozyurt/94f32b32a1aa018c0b76 to your computer and use it in GitHub Desktop.

Revisions

  1. ergunozyurt revised this gist Oct 12, 2015. No changes.
  2. ergunozyurt created this gist Oct 12, 2015.
    17 changes: 17 additions & 0 deletions find_the_key_in_multidimension_array.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    function searchArrayForKey($search,$array) {
    $foundArray= array();
    foreach ($array as $key => $value) {
    if($key === $search)
    {
    $foundArray = $value;
    break;
    }
    else
    {
    if(is_array($value)){
    return searchSubArray($search,$value);
    }
    }
    }
    return $foundArray;
    }