Index arrays with string in PHP
Description
The following code shows how to index arrays with string.
Example
<?php/*w w w . j a v a 2 s . c o m*/
// fill in some information
$UserInfo["Name"] = "Jack";
$UserInfo["Location"] = "Main Street, California";
$UserInfo["Occupation"] = "Programmer";
//loop over values
foreach($UserInfo as $key=>$value)
{
print("$key is $value.<br>\n");
}
?>
The code above generates the following result.