title: How to find the index number of an array that contains a certain key/value
body: <pre><code>(
      [1] =&gt; Array
          (
              [rules_properties_id] =&gt; 1
              [operator] =&gt; &gt;=
              [value] =&gt; 2
              [function] =&gt; NumOrdersPlaced
              [rules_properties_params] =&gt; Array
                  (
                      [num_days] =&gt; 30
                      [customer_id] =&gt; 5
                  )
  
          )
  
      [2] =&gt; Array
          (
              [rules_properties_id] =&gt; 1
              [operator] =&gt; &gt;=
              [value] =&gt; 5
              [function] =&gt; NumOrdersPlaced
              [rules_properties_params] =&gt; Array
                  (
                      [num_days] =&gt; 90
                      [customer_id] =&gt; 5
                  )
  
          )
  
      [3] =&gt; Array
          (
              [rules_properties_id] =&gt; 2
              [operator] =&gt; &gt;
              [value] =&gt; 365
              [function] =&gt; CustAcctAge
              [rules_properties_params] =&gt; Array
                  (
                      [customer_id] =&gt; 5
                  )
  
          )
  
  )
  </code></pre>
  
  <p>That's the <code>print_r</code> of an array that I'm getting back from my database. I need to find the index number of the sub-array that contains the function called NumOrdersPlaced (the expected result would be 2.) Is the only way to do this by looping through the array and subarrays and comparing (as in <a href="https://stackoverflow.com/questions/1019076/how-to-search-by-key-value-in-a-multidimensional-array-in-php">this answer</a>)? Or is there a more efficient, elegant (i.e. one-liner) function available that I don't know about?</p>