I'm a php newbie and just learning about loops.
Ive just come across a problem, by accident, I think.
This is a piece of code:
Code: Select all
<?php
$prices = array('door' => 10, 'handle' => 20, 'frame' => 30);
while ($element = each($prices)) {
echo $element['key'];
echo ": ";
echo $element['value'];
echo "<br />";
}
echo "<br />";
foreach ($prices as $key => $value) {
echo $key . ": " . $value . "<br />";
}
echo "<br />";
while ($element = each($prices)) {
echo $element['key'];
echo ": ";
echo $element['value'];
echo "<br />";
}
?>
Regards,
Simon