In PHP 5.5.0 and above you no longer need a custom function to search through a multi-dimensional array. Combining the built-in PHP functions array_search and array_column will extract the index of the inner array. Here’s the usage using meta variables:

$inner_array_index = array_search( $needle_value, array_column( $haystack_array, 'Key_holding_value' ) );

And here’s a live example. It will return ‘2’:

$consulting_firms = array(
    array('name' => 'Bain & Co',               'location' => 'Boston',  'employees' => 2000),
    array('name' => 'Boston Consulting Group', 'location' => 'Boston',  'employees' =>  700),
    array('name' => 'Mckinsey & Co',           'location' => 'Chicago', 'employees' => 3000),
$inner_array_index = array_search( 'Chicago', array_column($consulting_firms, 'location') );

echo $inner_array_index;  // 2

Credits: Hat tip to xfoxawy for posting this solution to!

Don’t forget to enter your rants and raves in the comments section below!