View Single Post
  #41 (permalink)  
Old 11-07-2007, 02:07 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: PHP Optimization Tips

Hi,

Set the maxvalue for your for-loops before and not in the loop.
Code:
$maxvalue = 100/10;
for($i=0; $i<$maxvalue; $i++){
   // Some code
}
is faster than:
Code:
for($i=0; $i<100/10; $i++){
   // Some code
}
because the value is calculated once instead of ten times.

Regards,
R.Kamalakannan.
Reply With Quote
Sponsored Links