3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(); for ($i = 0; $i < 10000; ++$i) { $v = rand(1, 1000000); $a[] = $v; } echo "Size: ", count($a), PHP_EOL; $start = microtime( true ); for ($i = 0; $i < 10000; ++$i) { isset($a[rand(1, 1000000)]); } $total_time = microtime( true ) - $start; echo "Total time: ", number_format($total_time, 6), PHP_EOL; $start = microtime( true ); for ($i = 0; $i < 10000; ++$i) { in_array(rand(1, 1000000), $a); } $total_time = microtime( true ) - $start; echo "Total time: ", number_format($total_time, 6), PHP_EOL;
Output for 7.1.0
Size: 10000 Total time: 0.001251 Total time: 0.146697
Output for 7.0.14
Size: 10000 Total time: 0.001102 Total time: 0.154332
Output for 5.4.17
Size: 10000 Total time: 0.002319
Process exited with code 137.
Output for 5.4.16
Size: 10000 Total time: 0.004351 Total time: 2.149718
Output for 5.4.14
Size: 10000 Total time: 0.002001
Process exited with code 137.
Output for 5.4.13
Size: 10000 Total time: 0.002019
Process exited with code 137.
Output for 5.4.12
Size: 10000 Total time: 0.002816 Total time: 2.157493
Output for 5.4.8, 5.4.11
Size: 10000 Total time: 0.002062
Process exited with code 137.
Output for 5.4.9
Size: 10000 Total time: 0.004507 Total time: 2.228859
Output for 5.4.7
Size: 10000 Total time: 0.002103
Process exited with code 137.
Output for 5.4.6
Size: 10000 Total time: 0.004798 Total time: 2.071212
Output for 5.4.5
Size: 10000 Total time: 0.002266
Process exited with code 137.
Output for 5.4.4
Size: 10000 Total time: 0.002171
Process exited with code 137.
Output for 5.4.3
Size: 10000 Total time: 0.004056 Total time: 2.184257
Output for 5.4.2
Size: 10000 Total time: 0.002081
Process exited with code 137.
Output for 5.4.1
Size: 10000 Total time: 0.002276
Process exited with code 137.
Output for 5.4.0
Size: 10000 Total time: 0.002006
Process exited with code 137.
Output for 5.3.27
Size: 10000 Total time: 0.006704
Process exited with code 137.
Output for 5.3.25
Size: 10000 Total time: 0.002312 Total time: 1.664505
Output for 5.3.24
Size: 10000 Total time: 0.002310 Total time: 1.677947
Output for 5.3.23
Size: 10000 Total time: 0.002369 Total time: 1.718941
Output for 5.3.22
Size: 10000 Total time: 0.002363 Total time: 1.969880
Output for 5.3.21
Size: 10000 Total time: 0.002349 Total time: 2.003210
Output for 5.3.20
Size: 10000 Total time: 0.002257 Total time: 1.923848
Output for 5.3.19
Size: 10000 Total time: 0.002332
Process exited with code 137.
Output for 5.3.17
Size: 10000 Total time: 0.003460 Total time: 1.958256
Output for 5.3.16
Size: 10000 Total time: 0.002296 Total time: 1.876259
Output for 5.3.15
Size: 10000 Total time: 0.002199 Total time: 1.877728
Output for 5.3.14
Size: 10000 Total time: 0.002231 Total time: 1.699787
Output for 5.3.13
Size: 10000 Total time: 0.002190 Total time: 1.626518
Output for 5.3.12
Size: 10000 Total time: 0.002176 Total time: 1.649144
Output for 5.3.11
Size: 10000 Total time: 0.002198 Total time: 1.639765
Output for 5.3.10
Size: 10000 Total time: 0.002138 Total time: 1.760953
Output for 5.3.9
Size: 10000 Total time: 0.002281 Total time: 1.813160
Output for 5.3.8
Size: 10000 Total time: 0.002179 Total time: 1.736985
Output for 5.3.7
Size: 10000 Total time: 0.002157 Total time: 1.610943
Output for 5.3.6
Size: 10000 Total time: 0.002447 Total time: 1.622663
Output for 5.3.5
Size: 10000 Total time: 0.002404 Total time: 1.666549
Output for 5.3.4
Size: 10000 Total time: 0.002437 Total time: 1.635451
Output for 5.2.17
Size: 10000 Total time: 0.003034
Process exited with code 137.
Output for 5.2.16
Size: 10000 Total time: 0.003120
Process exited with code 137.
Output for 5.2.15
Size: 10000 Total time: 0.004228
Process exited with code 137.