| if ( | !function_exists('array_index_by_key') | ) |
|
When given an array of arrays (or objects) it will return the index of the sub-array where $key == $value.
Given the following array
$array = array(
[0] => array(
'value' => 1
),
[1] => array(
'value' => 2
)
);
you could find the index of the second array with the command
// Returns 1
array_index_by_key('value', 2, $array);
Parameters
| $key | The key to search on |
| $value | The value the key should be |
| $array | The array to search through |
| $identical | Whether to perform a strict type-checked comparison |
Returns
An INT that is the index of the sub-array, or false.