3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $vars = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'); $start = microtime(true); for($k=0;$k<100;$k++) { $str = ltrim(strrev(chunk_split(implode(array_reverse($vars)), 3, ';')),';'); } $end = microtime(true); echo $end - $start; echo "\n\n"; $start = microtime(true); for($k=0;$k<100;$k++) { $size = sizeOf($vars); for ($i = $size-3; $i > 0; $i-=3) { array_splice($vars,$i,0,";"); } } $end = microtime(true); echo $end - $start; echo "\n\n"; $start = microtime(true); for($k=0;$k<100;$k++) { $array = array_reverse(range('a', 'h')); // reverse $array = array_chunk($array, 3); // cut by threes $string = ''; foreach ($array as $value) { $string .= implode($value); // glue them if(count($value) == 3) { // if still three, add a semi $string .= ';'; } } $string = strrev($string); // then reverse them again } $end = microtime(true); echo $end - $start;
based on augiS
Output for 7.1.0
0.00010299682617188
Process exited with code 137.
Output for 7.0.14
0.00014781951904297
Process exited with code 137.
Output for 7.0.6
6.6995620727539E-5
Process exited with code 137.
Output for 7.0.5
6.5088272094727E-5
Process exited with code 137.
Output for 7.0.4
8.8930130004883E-5
Process exited with code 137.
Output for 7.0.3
6.9856643676758E-5
Process exited with code 137.
Output for 7.0.2
5.6028366088867E-5
Process exited with code 137.
Output for 7.0.1
7.7962875366211E-5
Process exited with code 137.
Output for 7.0.0
6.0081481933594E-5
Process exited with code 137.
Output for hhvm-3.12.0
9.7036361694336E-5
Process exited with code 137.
Output for hhvm-3.10.0
0.00011277198791504
Process exited with code 137.
Output for 5.6.28
0.0002138614654541
Process exited with code 137.
Output for 5.6.15, 5.6.21
0.0001068115234375
Process exited with code 137.
Output for 5.1.5, 5.6.20
0.00014400482177734
Process exited with code 137.
Output for 5.6.19
0.00011301040649414
Process exited with code 137.
Output for 5.6.18
0.00011682510375977
Process exited with code 137.
Output for 5.3.15, 5.3.26, 5.4.28, 5.6.17
0.00015401840209961
Process exited with code 137.
Output for 5.6.16
0.00018000602722168
Process exited with code 137.
Output for 5.5.24, 5.6.14
0.00011396408081055
Process exited with code 137.
Output for 5.6.13
0.00016498565673828
Process exited with code 137.
Output for 5.6.12
0.00010895729064941
Process exited with code 137.
Output for 5.4.12, 5.6.11
0.00017905235290527
Process exited with code 137.
Output for 5.6.10
0.00017094612121582
Process exited with code 137.
Output for 5.4.6, 5.4.22, 5.4.27, 5.6.9
0.00013494491577148
Process exited with code 137.
Output for 5.6.8
0.00020098686218262
Process exited with code 137.
Output for 5.5.35
0.00017285346984863
Process exited with code 137.
Output for 5.2.4, 5.3.28, 5.5.34
0.00015091896057129
Process exited with code 137.
Output for 5.5.33
0.00015783309936523
Process exited with code 137.
Output for 5.3.6, 5.5.32
0.00018906593322754
Process exited with code 137.
Output for 5.5.27, 5.5.31
0.00011205673217773
Process exited with code 137.
Output for 5.5.30
0.00012612342834473
Process exited with code 137.
Output for 5.1.3, 5.5.29
0.00016999244689941
Process exited with code 137.
Output for 5.5.28
0.00014591217041016
Process exited with code 137.
Output for 5.5.26
0.00021696090698242
Process exited with code 137.
Output for 5.5.25
0.00015020370483398
Process exited with code 137.
Output for 5.4.45
9.4890594482422E-5
Process exited with code 137.
Output for 5.1.0, 5.4.44
0.00018095970153809
Process exited with code 137.
Output for 5.4.41, 5.4.43
0.0001838207244873
Process exited with code 137.
Output for 5.4.42
0.00019598007202148
Process exited with code 137.
Output for 5.4.40
0.00019097328186035
Process exited with code 137.
Output for 5.4.39
0.00018310546875
Process exited with code 137.
Output for 5.4.38
0.0003359317779541
Process exited with code 137.
Output for 5.4.37
0.00029802322387695
Process exited with code 137.
Output for 5.4.36
0.00024986267089844
Process exited with code 137.
Output for 5.4.35
0.00031495094299316
Process exited with code 137.
Output for 5.4.34
0.00030279159545898
Process exited with code 137.
Output for 5.4.1, 5.4.32
0.00013613700866699
Process exited with code 137.
Output for 5.3.27, 5.4.31
0.00015902519226074
Process exited with code 137.
Output for 5.4.17, 5.4.30
0.00013017654418945
Process exited with code 137.
Output for 5.2.1, 5.4.4, 5.4.29
0.00013589859008789
Process exited with code 137.
Output for 5.4.26
0.00013399124145508
Process exited with code 137.
Output for 5.4.25
0.00015497207641602
Process exited with code 137.
Output for 5.3.5, 5.3.9, 5.4.24
0.00014305114746094
Process exited with code 137.
Output for 5.2.17, 5.4.23
0.00013303756713867
Process exited with code 137.
Output for 5.4.21
0.00013279914855957
Process exited with code 137.
Output for 5.4.3, 5.4.20
0.0001368522644043
Process exited with code 137.
Output for 5.1.1, 5.2.7, 5.3.17, 5.3.24, 5.4.19
0.0001680850982666
Process exited with code 137.
Output for 5.2.10, 5.2.12, 5.3.0, 5.4.0, 5.4.18
0.00013899803161621
Process exited with code 137.
Output for 5.4.16
0.00016617774963379
Process exited with code 137.
Output for 5.2.13, 5.4.15
0.00014686584472656
Process exited with code 137.
Output for 5.2.6, 5.4.2, 5.4.14
0.00013208389282227
Process exited with code 137.
Output for 5.4.13
0.0001370906829834
Process exited with code 137.
Output for 5.4.11
0.00017714500427246
Process exited with code 137.
Output for 5.4.10
0.00032591819763184
Process exited with code 137.
Output for 5.4.9
0.00015616416931152
Process exited with code 137.
Output for 5.2.16, 5.4.8
0.00014901161193848
Process exited with code 137.
Output for 5.4.7
0.00014996528625488
Process exited with code 137.
Output for 5.4.5
0.00018191337585449
Process exited with code 137.
Output for 5.3.22, 5.3.29
0.00015592575073242
Process exited with code 137.
Output for 5.1.4, 5.3.25
0.0001671314239502
Process exited with code 137.
Output for 5.3.23
0.00017404556274414
Process exited with code 137.
Output for 5.3.21
0.00016307830810547
Process exited with code 137.
Output for 5.3.1, 5.3.20
0.00016403198242188
Process exited with code 137.
Output for 5.3.19
0.00017189979553223
Process exited with code 137.
Output for 5.1.6, 5.3.18
0.00017499923706055
Process exited with code 137.
Output for 5.3.16
0.00017595291137695
Process exited with code 137.
Output for 5.3.14
0.0003211498260498
Process exited with code 137.
Output for 5.3.13
0.00028014183044434
Process exited with code 137.
Output for 5.3.12
0.00018405914306641
Process exited with code 137.
Output for 5.3.11
0.00014805793762207
Process exited with code 137.
Output for 5.3.10
0.00019502639770508
Process exited with code 137.
Output for 5.3.8
0.00018119812011719
Process exited with code 137.
Output for 5.3.4, 5.3.7
0.00014495849609375
Process exited with code 137.
Output for 5.3.3
0.00015997886657715
Process exited with code 137.
Output for 5.2.15, 5.3.2
0.00015807151794434
Process exited with code 137.
Output for 5.2.14
0.00014114379882812
Process exited with code 137.
Output for 5.2.11
0.00016903877258301
Process exited with code 137.
Output for 5.2.9
0.00015711784362793
Process exited with code 137.
Output for 5.2.8
0.00016188621520996
Process exited with code 137.
Output for 5.2.5
0.00014209747314453
Process exited with code 137.
Output for 5.2.3
0.00014615058898926
Process exited with code 137.
Output for 5.2.2
0.00013995170593262
Process exited with code 137.
Output for 5.2.0
0.00013422966003418
Process exited with code 137.
Output for 5.1.2
0.00014710426330566
Process exited with code 137.
Output for 5.0.5
0.00018978118896484
Process exited with code 137.
Output for 5.0.4
0.00018620491027832
Process exited with code 137.
Output for 5.0.3
0.00019216537475586
Process exited with code 137.
Output for 5.0.2
0.00017690658569336
Process exited with code 137.
Output for 5.0.1
0.00021004676818848
Process exited with code 137.
Output for 5.0.0
0.00020384788513184
Process exited with code 137.
Output for 4.4.9
0.00026500000000002
Process exited with code 137.
Output for 4.4.8
0.00024299999999999
Process exited with code 137.
Output for 4.4.7
0.00025900000000001
Process exited with code 137.
Output for 4.4.6
0.000363
Process exited with code 137.
Output for 4.4.5
0.00022499999999998
Process exited with code 137.
Output for 4.4.4
0.00025500000000001
Process exited with code 137.
Output for 4.4.3
0.00021199999999999
Process exited with code 137.
Output for 4.4.2
0.00021900000000002
Process exited with code 137.
Output for 4.4.1
0.00022500000000003
Process exited with code 137.
Output for 4.4.0
0.00022700000000003
Process exited with code 137.
Output for 4.3.11
0.00024099999999999
Process exited with code 137.
Output for 4.3.10
0.00021700000000002
Process exited with code 137.
Output for 4.3.9
0.00023699999999999
Process exited with code 137.
Output for 4.3.8
0.00039699999999998
Process exited with code 137.
Output for 4.3.7
0.00025400000000003
Process exited with code 137.
Output for 4.3.6
0.00023999999999996
Process exited with code 137.
Output for 4.3.5
0.00023499999999999
Process exited with code 137.
Output for 4.3.4
0.00024400000000002
Process exited with code 137.
Output for 4.3.3
0.00023299999999998
Process exited with code 137.
Output for 4.3.2
0.00021300000000002
Process exited with code 137.
Output for 4.3.1
0.00018299999999999
Process exited with code 137.
Output for 4.3.0
0.00020500000000001
Process exited with code 137.