|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-05-03 17:49 UTC] tboothby at felfel dot com
Looping structures should (IMO) all have a limiting variant.
For example,
while100($rec=mysql_fetch_row($res)) {...}
Would only loop 100 times
for1000($i=0;$i<count($search);$i++) {...}
Would loop 1000 times, etc.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
hm, would you also want while23859() ? also, would for1000($i=0;$i<count($search);$i++) {...} loop 1000 times even if $search contained less than 1000 values? plainly, you have this kind of functionality in any language. in PHP, your examples would look like this: $i = 0 ; while( 100 > $i ) { $i++ ; $rec = mysql_fetch_row( $res ) ... } and for( $i = 0 ; 1000 > $i && count( $search ) > $i ; $i++ ) ...