note 23767 deleted from function.next by dams
| From: | dams@php.net | Date: | Sat, 27 Jul 2002 22:58:35 +0000 |
| Subject: | note 23767 deleted from function.next by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33719@lists.php.net to get a copy of this message | ||
This example will start with the *second* entry because of the initial call to next().
$colorList=array("#FFFFFF","#F1F2E6","#CCCCCC");
for(..) {
..
$color = (next($colorList)) ? current($colorList) : reset($colorList);
..
}
Here is an example that will start with the first entry.
$colorList=array("#FFFFFF","#F1F2E6","#CCCCCC");
for(..) {
..
$color = current($colorList);
if(!next($colorList)){
reset($colorList);
}
..
}
It takes a little more code, but if you need the first entry to come up first or are a stickler for
details like me, then you will need something like it.