For ... <= max($myArray) vs For ... <= $max

From: Date: Fri, 08 Nov 2002 11:13:01 +0000
Subject: For ... <= max($myArray) vs For ... <= $max
Groups: php.general 
Request: Send a blank email to php-general+get-123348@lists.php.net to get a copy of this message
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?

« previous php.general (#123348) next »