Is PHP smart enough to optimize loops?

That is, are these two 'for...loops' equivalent or is one slower than
the other?

$max = max($myArray);
for( $x = 1; $x <= $length; $x++ ) {}

 -- OR --

for( $x = 1; $x <= max($myArray); $x++ ) {}

My gut instinct tells me since PHP is interpreted, that the top one is
the better way to go, but with the Zend Optimizer, I don't know if PHP
handles them the same way or not?

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to