Sancar Saran wrote:
> Another simple performance tip.
> 
> Most of for examples of php look like this
> for($x=0;$x<sizeof($arrSometing);$x++)
> 
> This is bad. In every cycle you call sizeof
> 
> this was good
> $intSize = sizeof($arrSometing);
> for($x=0;$x<$intSize;$x++)
> 
> if u use.
> for($x=0;$x<$intSiz;++$x). You may gain another %10 
> 
> to determine costs of your functions use xdebug and kcachegrind.

I've always used pre-increment in loops like you suggest as it was an
ingrained part of my C/C++ learning from a performance perspective. I
wasn't sure if the same was true in PHP but you seem to suggest it is,
so I feel justified now :)

Col

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to