- microtime: documentation ( source)
<?php
function f1_virgule() {
$a = '';
for($i=0; $i<100000; ++$i) {
echo $a,$i,"\n";
}
}
function f2_point() {
$a = '';
for($i=0; $i<100000; ++$i) {
echo $a.$i."\n";
}
}
$start = microtime(true);
f2_point();
$stop = microtime(true);
$time_point = $stop - $start;
$start = microtime(true);
f1_virgule();
$stop = microtime(true);
$time_virgule = $stop - $start;
echo 'time virgule : ' . $time_virgule . "\n";
echo 'time point : ' . $time_point . "\n";
echo 'time virgule > time time_point => ' . ($time_virgule > $time_point);
?>