RE: [PHP] Efficency in looping arrays?
| From: | Ford, Mike | Date: | Wed, 17 Nov 2004 13:43:31 +0000 |
| Subject: | RE: [PHP] Efficency in looping arrays? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202291@lists.php.net to get a copy of this message | ||
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
> -----Original Message-----
> From: Peter Lauri [mailto:peter@lauri.se]
> Sent: 17 November 2004 12:11
> For the moment when I loop an array I use something like this:
>
> reset($arr);
> while($a=each($arr)) {
> echo $a['value'];
> }
>
> But the each() function genereates a array with four elements
> (0,1,value, key), I am only interested in the "value".
foreach ($arr as $value)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211