<?php
$time = [0, 0, 0, 0];for($i = 0; $i < 50; ++$i){
$k = 0;
$t = microtime(true);
$x = 0;
for($j = 0; $j < 10000000; ++$j)
++$x;
$time[$k++] += microtime(true) - $t;
$t = microtime(true);
$x = 0;
for($j = 0; $j < 10000000; ++$j)
$x++;
$time[$k++] += microtime(true) - $t;
$t = microtime(true);
$x = 0;
for($j = 0; $j < 10000000; ++$j)
$x += 1;
$time[$k++] += microtime(true) - $t;
$t = microtime(true);
$x = 0;
for($j = 0; $j < 10000000; ++$j)
$x = $x + 1;
$time[$k++] += microtime(true) - $t;
}
echo '++$x: ', $time[0] * 1000, 'ms<br />';
echo '$x++: ', $time[1] * 1000, 'ms<br />';
echo '$x += 1: ', $time[2] * 1000, 'ms<br />';
echo '$x = $x + 1: ', $time[3] * 1000, 'ms<br />';
preferences:
32.48 ms | 402 KiB | 5 Q