It seems that it makes almost no difference if you switch in and out of
the parser or stay within it...
Does this seem like a fair test? Having said that, I would suggest
always using the first method as it's much cleaner to read and color
coding works in most editors.
-- output ---
version one: 0.098537087440491 seconds
version two: 0.096035003662109 seconds
--- test ---
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$ITERATIONS = 10000;
$time_start = getmicrotime();
for ($i = 1; $i < $ITERATIONS; $i++)
{
?>
blah <?=$i?>
<?php
}
$time_end = getmicrotime();
$time1 = $time_end - $time_start;
$time_start = getmicrotime();
$tf = TRUE;
for ($i = 1; $i < $ITERATIONS; $i++)
{
echo "blah ".$i."\n";
}
$time_end = getmicrotime();
$time2 = $time_end - $time_start;
echo "<P>version one: \t$time1 seconds<P>\n";
echo "version two: \t$time2 seconds<P>\n";
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php