note 39061 added to function.array-shift

From: Date: Thu, 15 Jan 2004 17:55:01 +0000
Subject: note 39061 added to function.array-shift
Groups: php.notes 
Request: Send a blank email to php-notes+get-63638@lists.php.net to get a copy of this message
How about using foreach? That was made for looping through arrays after all. <?php $styles = array('style1', 'style2', 'style3', ... 'stylen'); while (true) { foreach ($styles as $style) { if (haveMoreToPrint()) print('<div class="' . $style . '">Some content</div>'); else break 2; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.array-shift.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39061 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39061&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39061&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63638) next »