3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 7.1.7
f(1001)=3147833 time=0.000072 seconds.
Output for 7.1.6
f(1001)=3147833 time=0.000065 seconds.
Output for 7.1.5
f(1001)=3147833 time=0.000066 seconds.
Output for 7.1.0
f(1001)=3147833 time=0.000139 seconds.
Output for 7.0.20
f(1001)=3147833 time=0.000125 seconds.
Output for 7.0.6
f(1001)=3147833 time=0.000118 seconds.
Output for 7.0.5
f(1001)=3147833 time=0.000128 seconds.
Output for 7.0.2, 7.0.4
f(1001)=3147833 time=0.000120 seconds.
Output for 7.0.3
f(1001)=3147833 time=0.000123 seconds.
Output for 7.0.1
f(1001)=3147833 time=0.000131 seconds.
Output for 7.0.0
f(1001)=3147833 time=0.000138 seconds.
Output for 5.6.21
f(1001)=3147833 time=0.000236 seconds.
Output for 5.6.2, 5.6.20
f(1001)=3147833 time=0.000215 seconds.
Output for 5.5.8, 5.6.19
f(1001)=3147833 time=0.000208 seconds.
Output for 5.6.18
f(1001)=3147833 time=0.000199 seconds.
Output for 5.5.11, 5.6.3, 5.6.17
f(1001)=3147833 time=0.000201 seconds.
Output for 5.6.16
f(1001)=3147833 time=0.000196 seconds.
Output for 5.5.5, 5.6.15
f(1001)=3147833 time=0.000425 seconds.
Output for 5.6.14
f(1001)=3147833 time=0.000210 seconds.
Output for 5.6.13
f(1001)=3147833 time=0.000217 seconds.
Output for 5.5.4, 5.5.7, 5.6.12
f(1001)=3147833 time=0.000222 seconds.
Output for 5.6.11
f(1001)=3147833 time=0.000274 seconds.
Output for 5.6.10
f(1001)=3147833 time=0.000241 seconds.
Output for 5.6.9
f(1001)=3147833 time=0.000289 seconds.
Output for 5.6.8
f(1001)=3147833 time=0.000220 seconds.
Output for 5.5.16, 5.6.7
f(1001)=3147833 time=0.000286 seconds.
Output for 5.6.6
f(1001)=3147833 time=0.000292 seconds.
Output for 5.6.5
f(1001)=3147833 time=0.000219 seconds.
Output for 5.5.3, 5.6.4
f(1001)=3147833 time=0.000237 seconds.
Output for 5.5.28, 5.5.35, 5.6.1
f(1001)=3147833 time=0.000213 seconds.
Output for 5.5.2, 5.6.0
f(1001)=3147833 time=0.000204 seconds.
Output for 5.5.33 - 5.5.34
f(1001)=3147833 time=0.000197 seconds.
Output for 5.5.32
f(1001)=3147833 time=0.000198 seconds.
Output for 5.5.31
f(1001)=3147833 time=0.000206 seconds.
Output for 5.5.30
f(1001)=3147833 time=0.000255 seconds.
Output for 5.5.29
f(1001)=3147833 time=0.000449 seconds.
Output for 5.5.22, 5.5.27
f(1001)=3147833 time=0.000223 seconds.
Output for 5.5.26
f(1001)=3147833 time=0.000239 seconds.
Output for 5.5.14, 5.5.25
f(1001)=3147833 time=0.000231 seconds.
Output for 5.5.24
f(1001)=3147833 time=0.000224 seconds.
Output for 5.5.23
f(1001)=3147833 time=0.000290 seconds.
Output for 5.5.21
f(1001)=3147833 time=0.000272 seconds.
Output for 5.5.20
f(1001)=3147833 time=0.000312 seconds.
Output for 5.5.19
f(1001)=3147833 time=0.000214 seconds.
Output for 5.5.18
f(1001)=3147833 time=0.000396 seconds.
Output for 5.5.15
f(1001)=3147833 time=0.000283 seconds.
Output for 5.5.13
f(1001)=3147833 time=0.000230 seconds.
Output for 5.5.12
f(1001)=3147833 time=0.000332 seconds.
Output for 5.5.10
f(1001)=3147833 time=0.000245 seconds.
Output for 5.5.9
f(1001)=3147833 time=0.000234 seconds.
Output for 5.5.6
f(1001)=3147833 time=0.000277 seconds.
Output for 5.5.1
f(1001)=3147833 time=0.000200 seconds.
Output for 5.5.0
f(1001)=3147833 time=0.000211 seconds.

preferences:
42.95 ms | 613 KiB | 16 Q