note 110589 added to function.sizeof
| From: | codeartha at gmail dot com | Date: | Fri, 09 Nov 2012 20:31:54 +0000 |
| Subject: | note 110589 added to function.sizeof | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191830@lists.php.net to get a copy of this message | ||
instead of using:
for ($i=0; $i<sizeof($array); $i++) {
...
}
you can, like mensionned before, use:
$max = sizeof($array);
for ($i=0; $i<$max; $i++) {
...
}
but I would assume you can cantract this like that:
for ($i=0, $max = sizeof($array); $i<$max; $i++) {
...
}
not that it changes a lot but that might be usefull for some people :)
----
Server IP: 69.147.83.199
Probable Submitter: 212.224.134.7
----
Manual Page -- http://www.php.net/manual/en/function.sizeof.php
Edit -- https://master.php.net/note/edit/110589
Del: integrated -- https://master.php.net/note/delete/110589/integrated
Del: useless -- https://master.php.net/note/delete/110589/useless
Del: bad code -- https://master.php.net/note/delete/110589/bad+code
Del: spam -- https://master.php.net/note/delete/110589/spam
Del: non-english -- https://master.php.net/note/delete/110589/non-english
Del: in docs -- https://master.php.net/note/delete/110589/in+docs
Del: other reasons-- https://master.php.net/note/delete/110589
Reject -- https://master.php.net/note/reject/110589
Search -- https://master.php.net/manage/user-notes.php