I have an array where I want to search the uid and get the key of the array.
uid
Assume we have the following 2-dimensional array:
You can use array_column for that.
$user = array_search('5465', array_column($userdb, 'uid')); print_r($userdb[$user]);
5465 is the user ID, uid is the key that contains user ID and $userdb is the array which is defined in the question.