PHP OOP Multidimensional Array Search Issue
<p>I have a function</p>

<pre><code>function GetArrKey( $findArr, $key_arr, $depth=0 )
{
  if( count($key_arr) &lt;= $depth || !array_key_exists($key_arr[$depth], $findArr) )
    return NULL;
  else if( count($key_arr) == $depth+1 )
    return $findArr[$key_arr[$depth]];

  return self::GetArrKey( $findArr[$key_arr[$depth]], $key_arr, $depth+1 );
}
</code></pre>

<p>That searches an array and returns the part of the array that matches what I need.</p>

<p>The only problem is it seems to be returning the exact same value. For example, I have this function in a foreach loop </p>

<pre><code>foreach($e as $k =&gt; $v) {
  $value = GetArrayKey(array,$k);
  print_r($value);
}
</code></pre>

<p>and it's printing the exact same value 5 times (but the $k that I am using to search for is different each time).</p>

<p>I'm assuming it is because of the return self::GetArrKey but I can't seem to fix it.</p>

<p>Examples...</p>

<pre><code>tweet-19486731414564564
Tweet 1
tweet-19486778435455556
Tweet 1
tweet-19703966855465458
Tweet 1
tweet-19842914654654650
Tweet 1
</code></pre>

<p>But it should do</p>

<pre><code>tweet-19486731414564564
Tweet 1
tweet-19486778435455556
Tweet 2
tweet-19703966855465458
Tweet 3
tweet-19842914654654650
Tweet 4
</code></pre>
