$pc_parts = array();
$pc_parts["Memory"] = "256 MB";
$pc_parts["CPU"] = "Athlon Thunderbird";
$pc_parts["Video Card"] = "Matrox";
$pc_parts["Hard Drive"] = "IBM";
foreach($pc_parts as $part_type => $part_name) {
$buf = sprintf("Part name is: %s Part value is:
%s", $part_type, $part_name);
echo $buf . "
";
}
echo "
";
reset($pc_parts);
while (list($part_type, $part_name) = each($pc_parts))
{
$buf = sprintf("Part name is: %s Part value is:
%s", $part_type, $part_name);
echo $buf . "
";
}
?>