你可以在PHP数组键中使用逗号吗?

I'm wanting to make a PHP array and use people's names as keys mapping to employee ID numbers. Example:

$staffID = array(
   "Doe, Jane" => 124, 
   "Smith, John" => 876
);

I'd like to keep them LastName, FirstName so that I can easily peruse down the list later on. I'm concerned about those commas in the keys though. Is this valid in PHP?

Yes, they're just strings. You can have any valid string (or integer) as an array key.

Also you may use array_search() function

$staffID = array(
   124 => 'Doe, Jane', 
   876 => 'Smith, John'
);

$id = array_search('Smith, John', $staffID);