3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cube($n) { return($n * $n * $n); } $a = array(1, 2, 3, 4, 5); $start = microtime(true); for ($it = 1; $it <= 1000000; $it++) { $b = array_map("cube", $a); } echo microtime(true) - $start; echo "<br />"; $a = array(1, 2, 3, 4, 5); $start = microtime(true); for ($it = 1; $it <= 1000000; $it++) { foreach ($a as &$b) { $b = cube($b); } } echo microtime(true) - $start;
Output for 7.1.4
1.4571430683136<br />
Process exited with code 137.
Output for 7.1.3
1.266813993454<br />0.75522494316101
Output for 7.1.2
1.1389379501343<br />0.6790931224823
Output for 7.1.1
1.0434880256653<br />0.74678492546082
Output for 7.1.0
1.0117318630219<br />0.7016909122467
Output for 7.0.18
1.0266389846802<br />0.90978312492371
Output for 7.0.17
1.0995650291443<br />0.84054613113403
Output for 7.0.16
0.82085514068604<br />0.71024394035339
Output for 7.0.15
0.9094340801239<br />0.73909592628479
Output for 7.0.14
1.0891849994659<br />0.66972589492798
Output for 7.0.13
1.3243908882141<br />0.85365605354309
Process exited with code 137.
Output for 7.0.12
0.91568803787231<br />0.80713510513306
Output for 7.0.11
1.5065450668335<br />
Process exited with code 137.
Output for 7.0.10
1.3568410873413<br />
Process exited with code 137.
Output for 7.0.9
1.0167269706726<br />0.78464484214783
Output for 7.0.8
1.4682569503784<br />0.50050592422485
Output for 7.0.7
0.91694593429565<br />0.55867099761963
Output for 7.0.6
0.73364400863647<br />0.62107396125793
Output for 7.0.5
0.71160411834717<br />0.6605908870697
Output for 7.0.4
0.61727809906006<br />0.54969096183777
Output for 7.0.3
0.64275813102722<br />0.48056697845459
Output for 7.0.2
0.62904906272888<br />0.38618302345276
Output for 7.0.1
0.55656409263611<br />0.5551381111145
Output for 7.0.0
0.73287606239319<br />0.77955603599548

preferences:
62.15 ms | 401 KiB | 29 Q