- microtime: documentation ( source)
- ceil: documentation ( source)
- log: documentation ( source)
<?php
$x = 129;
$y = 1;
$m = microtime(true);
$y = 1 << ceil(log($x, 2));
$e = microtime(true);
echo ($e - $m), "\n\r";
$y = 1;
$m = microtime(true);
while ($y < $x) {
$y = $y <<1;
}
echo microtime(true) - $m;