indexing arrays with string



so far i've only seen arrays indexed by itergers, but it is also permissbible to use strings. sometimes there are called assocaited arrays, or hashes. they are helpful in situations where you are colectin differen type so information into one array. you could build inot your code a system where element zeor is a name, element one is a location, and element two is an occupation

here is an example:

<?php
// fill in some information
$userinfo["Name"] = "John Doe";
$userinfo["Location"] = "San Francisco";
$userinfo["Occupation"] = "Programmer";

foreach($userinfo as $key=>$value) {
print("$key is $value.<br>");
}
?>


the above will output:
Name is John Doe
Location is San Francisco
Occupation Programmer