title: Find a a value in a multidimentional array, and return a value from the same array
body: <p>I'm trying to find a value in a milti array's array, and after finding it, I want to return a different key, not sure how to explain it further.</p>
  <p>I have an array:</p>
  <pre><code>tempArray( [0] =&gt; Array
      (
          [id] =&gt; 18460
          [field_id] =&gt; 14
          [parent_id] =&gt; 165
          [custom_tab_field_id] =&gt; 17775
          [status] =&gt; 0
          [field_type] =&gt; 0
      )
  
  [1] =&gt; Array
      (
          [id] =&gt; 18461
          [field_id] =&gt; 2
          [parent_id] =&gt; 165
          [custom_tab_field_id] =&gt; 17776
          [status] =&gt; 0
          [field_type] =&gt; 2
      )
  
  [2] =&gt; Array
      (
          [id] =&gt; 18462
          [field_id] =&gt; 12
          [parent_id] =&gt; 165
          [custom_tab_field_id] =&gt; 17777
          [status] =&gt; 2
          [field_type] =&gt; 2
      ))
  </code></pre>
  <p>I'm trying to find the array by [custom_tab_field_id], and return the current's array [status].</p>
  <p>I created a function that should do just that, but it's always returning 0.</p>
  <p>The function:</p>
  <pre><code>function searchForStatus($id, $array){
          
          $returnedStatus = &quot;0&quot;;
          foreach ($array as $key =&gt; $val){
              if ($val['custom_tab_field_id'] == $id){
                  return $returnedStatus = $array[$key]['status'];
              }
          }
          return $returnedStatus;
      }
  </code></pre>
  <p>and then simply call for the function by passing values</p>
  <pre><code>$returnedStatus = searchForStatus($field['custom_tab_field_id'], $tempArr);
  </code></pre>