I have an array where I want to search the name and get the key of the array that its associated to.
Examples
Assume we have the following 2-dimensional array with the second dimension being associated to a key:
$leaderboard = array(
029102938093028 => array(
'Rank' => '1st',
'Name' => 'HenryB',
'Kills' => 10,
'Deaths' => 4,
'Headshots' => 5
),
029382912873929 => array(
'Rank' => '2nd',
'Name' => 'Will R',
'Kills' => 6,
'Deaths' => 4,
'Headshots' => 1
),
0283928293898303 => array(
'Rank' => '3rd',
'Name' => 'Robert M',
'Kills' => 3,
'Deaths' => 10,
'Headshots' => 0
),
);
The function call search_by_uid("HenryB") (name of the first user) should return 029102938093028 (The key of the array).
The function call search_by_uid("Robert M") should return 0283928293898303.
I have seen examples using multidemensional arrays where it returns the index but never the associated index. Please close if repeat question that i am unable to find.