I write a program in PHP and now I learn assosiated arrays theme. This my cration and what is the program in it:
<?PHP
out("test starts");
$people[] = array (
"name" => "Brook",
"age" => "42"
);
$people[] = array (
"name" => "Peter",
"age" => "18"
);
foreach($people as $person)
out($person=>["name"] . " - " . $person=>["age"]);
/*
I wanna this:
Brook - 42
Peter - 18
*/
var_dump($people);
out("test ends");
function out($what) {
echo $what . "<br>\n";
}
?>
The var_dump is show me the array creation is good but the trouble is at foreach.