- microtime: documentation ( source)
- explode: documentation ( source)
- sprintf: documentation ( source)
<?php
function doNothing() {}
$start = microtime();
for ($i=0;$i<1000;$i++) { doNothing(); }
$end = microtime();
$start = explode(' ', $start);
$start = $start[0] + ($start[1] - 1378586325);
$end = explode(' ', $end);
$end = $end[0] + ($end[1] - 1378586325);
echo sprintf('%F', $end) . ' - ' . sprintf('%F', $start) . ' = ' . sprintf('%F', $end - $start);
$start = microtime(true);
for ($i=0;$i<1000;$i++) { doNothing(); }
$end = microtime(true);
echo sprintf('%F', $end) . ' - ' . sprintf('%F', $start) . ' = ' . sprintf('%F', $end - $start);