I have a multidimensional array. i want to find the position of given key in that array.
my array
Array
(
[200] => Array
(
[totalQuesAttempted] => 10
[totalCorrectQuestion] => 2
)
[100] => Array
(
[totalQuesAttempted] => 10
[totalCorrectQuestion] => 3
)
[400] => Array
(
[totalQuesAttempted] => 10
[totalCorrectQuestion] => 4
)
[300] => Array
(
[totalQuesAttempted] => 10
[totalCorrectQuestion] => 7
)
[500] => Array
(
[totalQuesAttempted] => 10
[totalCorrectQuestion] => 8
)
)
i am passing UPID value, and i need index position of that UPID.
$UPID = "300";
$result = array_search($UPID, array_values($usersAttemptsInfo));
my expected output is 3 because 300 index position is 3