Suppose an array like the following:
Array
(
[a] => Array
(
[id] => 3
[x] => binginb
)
[b] => Array
(
[id] => 5
[x] => dibdab
)
)
Now I would like to access this array based on its contents, so id and x in this case.
It would be nice here to be able to do something like
$i = array_search(5,array_column($a,'id'));
$stuff = dostuff($a[$i]['x']);
but that doesn't work since $a[1] is an undefined offset.
Is it possible to do anything like this without mutating the original array?
id, but what would you expect back when there are multiple results?