Reputation: 215
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?
Upvotes: 3
Views: 979
Reputation: 5203
Yes, they're just strings. You can have any valid string (or integer) as an array key.
Upvotes: 11