Arrays and each()
| From: | Chris Blake | Date: | Thu, 10 Apr 2003 11:17:49 +0000 |
| Subject: | Arrays and each() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143311@lists.php.net to get a copy of this message | ||
Greetings learned PHP(eople),
On the advice of many on this list, I recently purchased
"PHP & MYSQL Web Development" by Luke Welling, and am now going through
each chapter learning about PHP.
One example from said tome (Chapter 3 pg 75) is as follows :
<?php
$prices = array('Guitars'=>1000, 'Drums'=>2000,
'Keyboards'=>3000);
//Use "each()" to output array
while ( $element = each( $prices) )
{
echo $element[ 'key' ] ;
echo ' - ';
echo $element['value'];
echo '<br />';
}
?>
The output is blank !
I`ve fiddled around with the brackets, quotes et al but still nadda.....
Any ideas ?
Thanks
--
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
What would I know about love at first sight,I`ve never seen a Diablo
filled with R 200-00 notes before !