note 112965 deleted from function.echo by googleguy
| From: | googleguy@php.net | Date: | Wed, 22 Jan 2014 20:52:18 +0000 |
| Subject: | note 112965 deleted from function.echo by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198306@lists.php.net to get a copy of this message | ||
Note Submitter: doydoy44
----
apparently ',' is faster then '.'
<?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);
?>
-------------------------------------
time virgule : 18.28688621521
time point : 17.781190156937
time virgule > time time_point => 1