Anonymous
public text v1 · immutable<?php
define ('MAX',2000000);
function f1()
{
for($i=0;$i<MAX; $i++)
{
$c = "$ test " . $i;
}
}
function f2()
{
for($i=0;$i<MAX; $i++)
{
$c = "$ test $i";
}
}
function f3()
{
for($i=0;$i<MAX; $i++)
{
$c = '$ test ' . $i;
}
}
$t1 = microtime(true);
f1();
echo 'Time 1: ' , (microtime(true) - $t1) , "\n";
$t2 = microtime(true);
f2();
echo 'Time 2: ' , (microtime(true) - $t2) , "\n";
$t3 = microtime(true);
f3();
echo 'Time 3: ' , (microtime(true) - $t3) , "\n";