note 36665 added to function.array-shift
| From: | mina86 at tlen dot pl | Date: | Sat, 18 Oct 2003 00:30:18 +0000 |
| Subject: | note 36665 added to function.array-shift | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58780@lists.php.net to get a copy of this message | ||
archangel, 04-Mar-2003 08:11:
This method is just waste of CPU, RAM and everything. Better would be:
<?php
$styles = array('style1', 'style2', 'style3', ... 'stylen');
$styles_count = count($styles);
for ($i = 0; haveMoreToPrint(); $i = ($i+1)%$styles_count) {
print('<div class="'.$styles[$i].'">Some
content</div>');
}
?>
It does the same thing but faster :)
----
Manual Page -- http://www.php.net/manual/en/function.array-shift.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36665
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36665&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36665&report=yes
Search -- http://master.php.net/manage/user-notes.php