- microtime: documentation ( source)
<?php
$startMath = microtime();
for ($i = 0; $i < 10000; $i++)
$var = 24*3600*365;
$endMath = microtime();
$timeMath = $endMath - $startMath;
echo 'Math took : ',$timeMath,'ms';
$startNoMath = microtime();
for ($i = 0; $i < 10000; $i++)
$var = 31536000;
$endNoMath = microtime();
$timeNoMath = $endNoMath - $startNoMath;
echo 'No math took : ',$timeNoMath,'ms';