I am trying to search an array for a given value. Once I find this value, I need the array key value to access other information in the array. Here is the array I need to search:
array(3) {
  [0]=>
  array(20) {
    ["FirstName"]=>
    string(7) "Person1"
    ["LastName"]=>
    string(7) "Person1"
    ["UserId"]=>
    int(5632414)
  }
  [1]=>
  array(20) {
     ["FirstName"]=>
    string(7) "Person2"
    ["LastName"]=>
    string(7) "Person2"
    ["UserId"]=>
    int(5632414)
  }
  [2]=>
  array(20) {
     ["FirstName"]=>
    string(7) "Person3"
    ["LastName"]=>
    string(7) "Person3"
    ["UserId"]=>
    int(5632414)
  }
}
I am searching the array for a specific UserId. I have tried several bits of code but none seem to work. All I get is a blank screen when I run the script. Here is my most current code:
$array = json_decode($output);
for ($x = 0; $x <= count($array); $x++) {
    $key = array_search('5632414', $array);
    echo $key;
}
 
     
     
    