title: php recursive array search - return specific parent
body: <p>I have an array that can vary in its dimension, sometimes can be small, sometimes can go deeper. I'm trying to search for a particular element in the array and if it is found, I would like to get a specific parent. So for instance, if I have an array as:</p>
  
  <p>Again, the dimension can change, however, I'm looking for the the most outer parent's <strong>key</strong> that has siblings. <strong>(<em>in this case</em>)</strong></p>
  
  <pre><code>Array (
    [0] =&gt; Array (
      [0] =&gt; Array (              
          [0] =&gt; Array (         &lt;&lt;----------------------------------------+
                [0] =&gt; FOO0                                                |  
                [1] =&gt; BAR0         //Search BAR0 returns parent key 0     +
                [2] =&gt; Array(                                              |
                      [0] =&gt; HELLO0                                        |
                      [1] =&gt; BYE0   //Search BYE0 returns parent key 0     +
                    )                                                      |
                [3] =&gt; FOO0                                                |
                [4] =&gt; Array (                                             |
                      [0] =&gt; HELLO0  //Search HELLO0 returns parent key 0 --
                    )
              )
          [1] =&gt; Array (         &lt;&lt;----------------------------------------+
                [0] =&gt; FOO1                                                |
                [1] =&gt; BAR1                                                |
                [2] =&gt; Array (                                             |
                      [0] =&gt; HELLO1                                        |
                      [1] =&gt; BYE1                                          |
                    )                                                      |
                [3] =&gt; BASE1                                               |
                [4] =&gt; Array (                                             |
                      [0] =&gt; BAZ1                                          |
                      [1] =&gt; Array (                                       | 
                            [0] =&gt; DOO1 //Search DOO1 returns parent key 1 +
                            [1] =&gt; BOB2 //Search BOB2 returns parent key 1 +
                          )
                  )
            )
          [2] =&gt; FOO2 // Search FOO2 returns key 2 (itself)
          )
      )
  )
  </code></pre>
  
  <p>Sample Output for FOO2</p>
  
  <pre><code>[2] =&gt; FOO2 // searched value
  </code></pre>
  
  <p>I would really appreciate some help! Thanks!</p>