note 82296 deleted from function.sizeof by felipe
| From: | felipe@php.net | Date: | Fri, 04 Apr 2008 21:44:41 +0000 |
| Subject: | note 82296 deleted from function.sizeof by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137938@lists.php.net to get a copy of this message | ||
Note Submitter: cholo.uno at gmail dot com
----
I'd suggest that instead of using
$max = sizeof($array);
for ($i=0; $i<$max; $i++) {
...
}
You try
$max = sizeof($array) - 1;
for ($i=0; $i<$max; $i++) {
...
}
This will account for the fact that the for loop starts at zero and you won't have an
'extra' loop. Alternatively you can try
$max = sizeof($array);
for ($i=1; $i<$max; $i++) {
...
}