I have an array thus (got this using var_dump
):
array
0 =>
array
'post_id' => string '6' (length=1)
1 =>
array
'post_id' => string '9' (length=1)
I want to get the key when I have just the post_id
. For example, I want '0' returned if I have '6' and '1' if I have '9'. I have tried:
$key = array_keys($subs, array_keys($subs[??], 6));
given that the $subs
is the array. The issue is, I don't know how to iterate through the array 'within' the 'parent' array, hence, the '??'