note 23416 added to function.next
| From: | php-general at lists dot php dot net | Date: | Thu, 18 Jul 2002 00:00:31 +0000 |
| Subject: | note 23416 added to function.next | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33228@lists.php.net to get a copy of this message | ||
One example what you can do with next, current and reset functions:
$colorList=array("#FFFFFF","#F1F2E6","#CCCCCC");
for(..) {
..
$color = (next($colorList)) ? current($colorList) : reset($colorList);
..
}
I have seen many people doing this with function and static variable. I like to do it this way =)
--
http://www.php.net/manual/en/function.next.php
http://master.php.net/manage/user-notes.php?action=edit+23416
http://master.php.net/manage/user-notes.php?action=delete+23416
http://master.php.net/manage/user-notes.php?action=reject+23416