PHPExcel for循环超时

I have this code where I want to set from 3 to 333 to have a certain row height at every 30 interval, meaning at row 3, 33, 63, 93 up till 333:

for ($i=3; $i<340; $i+30){
        $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(57);
}

But when I click on controller actionGenerate(), it doesn't generate and timeouts me after 30 seconds. Can I know why isn't it generating?

If I were to use the manual way, as in doing line by line, PLUS having so many different kinds of settings, I'd be exhausted.

PHP limits the execution time of any script. The default time is 30 seconds. Your script probably takes longer than 30 seconds to execute.

Set your set_time_limit to 0. This will set it to unlimited.

like this:

set_time_limit(0);
for ($i=3; $i<340; $i+=30){ // <--- here was your problem
        $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(57);
}

And try again.

Info about set_time_limit in the docs

-- edit--

The problem was in the for loop.

$i + 30 adds 30 to $i but it does not assign it. It should be $i +=30