So if this is results from a query wouldn’t it be better to do the searching for the uid, name etc… in the database with a query and get the results you are looking for?. Just some food for thought. But to accomplish your problem is well loops. So i threw it in a function as i was not sure on what area’s it was important to search. Most common would be the uid but i did not want to make an assumption. So this little function will loop through the array and see if it can match a uid or name or pic_square and then gets the parent arrays id and deletes it and returns true on success and false on failure.
function userSearch($user_id = null, $name = null, $pic_square = null)
{
// check if it is an array and it has something in it
if(is_array($userdb) && count($userdb) > 0)
{
foreach($userdb as $sub_array => $user)
{
if($user['uid'] == $user_id)
{
unset($userdb[$sub_array]);
return true;
}
elseif(!is_null($name) && $user['name'] == $name)
{
unset($userdb[$sub_array]);
return true;
}
elseif(!is_null($pic_square) && $user['pic_square'] == $pic_square)
{
unset($userdb[$sub_array]);
return true;
}
}
}
return false;
}