3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function test_1($nb) { $t = microtime(true); $a = 'f'; $t = microtime(true); $b = ''; $t = microtime(true); for ($u=0; $u<$nb; $u++) { if ($a==='a') { $b .= $a; } else if ($a==='b') { $b .= $a; } else if ($a==='c') { $b .= $a; } else if ($a==='d') { $b .= $a; } else if ($a==='e') { $b .= $a; } else if ($a==='f') { $b .= $a; } } return (microtime(true) - $t); } function test_2($nb) { $a = 'f'; $b = ''; $t = microtime(true); for ($u=0; $u<$nb; $u++) { switch ($a) { case 'a': $b .= $a; case 'b': $b .= $a; case 'c': $b .= $a; case 'd': $b .= $a; case 'e': $b .= $a; case 'f': $b .= $a; } } return (microtime(true) - $t); } $nb = 10000000; echo 'test_1: '.test_1($nb)."\n"; echo 'test_2: '.test_2($nb)."\n";
Output for 7.1.0
test_1: -0.83803915977478 test_2: 1.3400051593781
Output for 7.0.14
test_1: -0.056936979293823 test_2: 1.2399408817291
Output for 7.0.6
test_1: 0.73280787467957 test_2: 0.61445903778076
Output for 7.0.5
test_1: 0.73169803619385 test_2: 0.59645891189575
Output for 7.0.4
test_1: 0.74526286125183 test_2: 0.62855195999146
Output for 7.0.3
test_1: 0.74134492874146 test_2: 0.67092895507812
Output for 7.0.2
test_1: 0.73223495483398 test_2: 0.6293580532074
Output for 7.0.1
test_1: 0.76544094085693 test_2: 0.65956902503967
Output for 7.0.0
test_1: 0.72192883491516 test_2: 0.58924603462219
Output for 5.3.6 - 5.3.7, hhvm-3.10.0 - 3.12.0

Process exited with code 137.
Output for 5.6.28
test_1: 1.0191020965576
Process exited with code 137.
Output for 5.6.21
test_1: 1.0651979446411
Process exited with code 137.
Output for 5.6.20
test_1: 1.0739321708679
Process exited with code 137.
Output for 5.6.19
test_1: 1.0904920101166
Process exited with code 137.
Output for 5.6.18
test_1: 1.2542150020599
Process exited with code 137.
Output for 5.6.17
test_1: 1.0884358882904
Process exited with code 137.
Output for 5.6.16
test_1: 1.0873539447784
Process exited with code 137.
Output for 5.6.15
test_1: 1.0537130832672
Process exited with code 137.
Output for 5.6.14
test_1: 1.0658779144287
Process exited with code 137.
Output for 5.6.13
test_1: 1.0598220825195
Process exited with code 137.
Output for 5.6.12
test_1: 1.0478041172028
Process exited with code 137.
Output for 5.6.11
test_1: 1.0496208667755
Process exited with code 137.
Output for 5.6.10
test_1: 1.0347139835358
Process exited with code 137.
Output for 5.6.9
test_1: 1.2309880256653
Process exited with code 137.
Output for 5.6.8
test_1: 1.0876579284668
Process exited with code 137.
Output for 5.6.7
test_1: 0.94077110290527
Process exited with code 137.
Output for 5.5.35
test_1: 1.0967519283295
Process exited with code 137.
Output for 5.5.34
test_1: 1.3030250072479
Process exited with code 137.
Output for 5.5.33
test_1: 1.038810968399
Process exited with code 137.
Output for 5.5.32
test_1: 1.0659148693085
Process exited with code 137.
Output for 5.5.31
test_1: 1.0709629058838
Process exited with code 137.
Output for 5.5.30
test_1: 1.4018540382385
Process exited with code 137.
Output for 5.5.29
test_1: 1.0795829296112
Process exited with code 137.
Output for 5.5.28
test_1: 1.1096630096436
Process exited with code 137.
Output for 5.5.27
test_1: 1.0783641338348
Process exited with code 137.
Output for 5.5.26
test_1: 1.0853359699249
Process exited with code 137.
Output for 5.5.25
test_1: 1.0365829467773
Process exited with code 137.
Output for 5.5.24
test_1: 1.0606009960175
Process exited with code 137.
Output for 5.4.45
test_1: 1.0834348201752
Process exited with code 137.
Output for 5.4.44
test_1: 1.1093859672546
Process exited with code 137.
Output for 5.4.43
test_1: 1.0436110496521
Process exited with code 137.
Output for 5.4.42
test_1: 1.0449120998383
Process exited with code 137.
Output for 5.4.41
test_1: 1.0311059951782
Process exited with code 137.
Output for 5.4.40
test_1: 1.0399258136749
Process exited with code 137.
Output for 5.4.39
test_1: 1.1376240253448
Process exited with code 137.
Output for 5.4.38
test_1: 1.0416619777679
Process exited with code 137.
Output for 5.4.37
test_1: 1.0128901004791
Process exited with code 137.
Output for 5.4.36
test_1: 1.0520479679108
Process exited with code 137.
Output for 5.4.35
test_1: 0.99171686172485
Process exited with code 137.
Output for 5.4.34
test_1: 1.2364230155945
Process exited with code 137.
Output for 5.4.32
test_1: 1.0215451717377
Process exited with code 137.
Output for 5.4.31
test_1: 1.0357558727264
Process exited with code 137.
Output for 5.4.30
test_1: 1.1336131095886
Process exited with code 137.
Output for 5.4.29
test_1: 1.2148458957672
Process exited with code 137.
Output for 5.4.28
test_1: 1.395015001297
Process exited with code 137.
Output for 5.4.27
test_1: 1.2847430706024
Process exited with code 137.
Output for 5.4.26
test_1: 1.1669278144836
Process exited with code 137.
Output for 5.4.25
test_1: 1.243283033371
Process exited with code 137.
Output for 5.4.24
test_1: 1.2356460094452
Process exited with code 137.
Output for 5.4.23
test_1: 1.2404599189758
Process exited with code 137.
Output for 5.4.22
test_1: 1.2344698905945
Process exited with code 137.
Output for 5.4.21
test_1: 1.2125709056854
Process exited with code 137.
Output for 5.4.20
test_1: 1.2401518821716
Process exited with code 137.
Output for 5.4.19
test_1: 1.615259885788
Process exited with code 137.
Output for 5.4.18
test_1: 1.4379878044128
Process exited with code 137.
Output for 5.4.17
test_1: 1.3047449588776
Process exited with code 137.
Output for 5.4.16
test_1: 1.2606749534607
Process exited with code 137.
Output for 5.4.15
test_1: 1.2502188682556
Process exited with code 137.
Output for 5.4.14
test_1: 1.5200719833374
Process exited with code 137.
Output for 5.4.13
test_1: 1.3782920837402
Process exited with code 137.
Output for 5.4.12
test_1: 1.3407139778137
Process exited with code 137.
Output for 5.4.11
test_1: 1.3421220779419
Process exited with code 137.
Output for 5.4.10
test_1: 1.5439641475677
Process exited with code 137.
Output for 5.4.9
test_1: 1.4890279769897
Process exited with code 137.
Output for 5.4.8
test_1: 1.2350618839264
Process exited with code 137.
Output for 5.4.7
test_1: 1.2272310256958
Process exited with code 137.
Output for 5.4.6
test_1: 1.2237150669098
Process exited with code 137.
Output for 5.4.5
test_1: 1.3246450424194
Process exited with code 137.
Output for 5.4.4
test_1: 1.5712580680847
Process exited with code 137.
Output for 5.4.3
test_1: 1.4771978855133
Process exited with code 137.
Output for 5.4.2
test_1: 1.3191649913788
Process exited with code 137.
Output for 5.4.1
test_1: 1.3518149852753
Process exited with code 137.
Output for 5.4.0
test_1: 1.7280340194702
Process exited with code 137.
Output for 5.3.29
test_1: 1.0800020694733
Process exited with code 137.
Output for 5.3.28
test_1: 1.4612758159637
Process exited with code 137.
Output for 5.3.27
test_1: 1.2538430690765
Process exited with code 137.
Output for 5.3.26
test_1: 1.436066865921
Process exited with code 137.
Output for 5.3.25
test_1: 1.2981948852539
Process exited with code 137.
Output for 5.3.24
test_1: 1.5117361545563
Process exited with code 137.
Output for 5.3.23
test_1: 1.3956680297852
Process exited with code 137.
Output for 5.3.22
test_1: 1.7940819263458
Process exited with code 137.
Output for 5.3.21
test_1: 1.9994530677795
Process exited with code 137.
Output for 5.3.20
test_1: 1.5518050193787
Process exited with code 137.
Output for 5.3.19
test_1: 1.754429101944
Process exited with code 137.
Output for 5.3.18
test_1: 1.515233039856
Process exited with code 137.
Output for 5.3.17
test_1: 1.6500902175903
Process exited with code 137.
Output for 5.3.16
test_1: 1.4679191112518
Process exited with code 137.
Output for 5.3.15
test_1: 1.5127890110016
Process exited with code 137.
Output for 5.3.14
test_1: 1.5436780452728
Process exited with code 137.
Output for 5.3.13
test_1: 1.5882840156555
Process exited with code 137.
Output for 5.3.12
test_1: 1.5814909934998
Process exited with code 137.
Output for 5.3.11
test_1: 2.2967410087585
Process exited with code 137.
Output for 5.3.10
test_1: 1.6562020778656
Process exited with code 137.
Output for 5.3.9
test_1: 1.8555948734283
Process exited with code 137.
Output for 5.3.8
test_1: 2.094379901886
Process exited with code 137.