Loop round a PHP associative array using For Each

 

<?PHP

$full_name = array();

$full_name["David"] = "Gilmour";
$full_name["Nick"] = "Mason";
$full_name["Roger"] = "Waters";
$full_name["Richard"] = "Wright";

foreach ($full_name as $first_name => $surname) {

print "Key = " . $first_name . " Value = " . $surname . "<BR>";

}

?>