- microtime: documentation ( source)
- error_reporting: documentation ( source)
- printf: documentation ( source)
<?php
error_reporting(E_ALL & ~E_NOTICE);
function f($n){for($x=$n;$x;$y++){for(;$n*$n<$x*$x+$y*$y;$x--);$c+=$x;}return$c*4+1;}
$n=1001;$s=microtime(1);$v=f($n);$t=microtime(1)-$s;
printf("f(%d)=%d\ntime=%f seconds.\n",$n,$v,$t);