note 82296 added to function.sizeof

From: Date: Fri, 04 Apr 2008 15:56:46 +0000
Subject: note 82296 added to function.sizeof
Groups: php.notes 
Request: Send a blank email to php-notes+get-137928@lists.php.net to get a copy of this message
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++) { ... } ---- Server IP: 209.41.74.194 Probable Submitter: 209.134.165.92 ---- Manual Page -- http://www.php.net/manual/en/function.sizeof.php Edit -- https://master.php.net/note/edit/82296 Del: integrated -- https://master.php.net/note/delete/82296/integrated Del: useless -- https://master.php.net/note/delete/82296/useless Del: bad code -- https://master.php.net/note/delete/82296/bad+code Del: spam -- https://master.php.net/note/delete/82296/spam Del: non-english -- https://master.php.net/note/delete/82296/non-english Del: in docs -- https://master.php.net/note/delete/82296/in+docs Del: other reasons-- https://master.php.net/note/delete/82296 Reject -- https://master.php.net/note/reject/82296 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137928) next »