Figure 2
PHP script using both character and integer elements within the same array
16, "PHP" => 3, "Java" => 10, "Other RPGs" => 37, "COBOL" => 35, "CL" => "20+", "Basic" => 25); // ((D))
echo "This script was written by $myName.
"; // ((E))
echo "He lives in $location and has been playing with computers for over $experience years.
";
echo "Here are a few of the languages he has used so far in his career:
";
foreach ($languages as $name => $years) { // ((F))
print "$name for $years years
"; // ((G))
}
// ((H)) The following lines demonstrate the
// debugging aids print_r() and var_dump()
echo "
Print_r output
";
print_r($languages);
echo "
Var_dump output
";
var_dump($languages);
?>