3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /* How many times the code under test should run in each function */ define('LOOP', 10); define('MAX', 10); function f1() { for ($i = 0; $i < LOOP; ++$i) { // one liner array_map with anonymous function - 5.3+ $array = array_map(function($d) { return 'count_' . $d; }, range(0, MAX)); } } function f2() { for ($i = 0; $i < LOOP; ++$i) { // another (convoluted) one line approach, avoiding array_map - 5.2+ $array = explode('#', 'count_' . implode('#count_', range(0, MAX))); } } $start = microtime(true); f1(); $stop = microtime(true); $time1 = $stop - $start; $start = microtime(true); f2(); $stop = microtime(true); $time2 = $stop - $start; echo $time1 . "\t"; echo $time2 . "\n";
Output for 7.1.0
2.9802322387695E-5 1.5020370483398E-5
Output for 7.0.14
2.8848648071289E-5 1.2874603271484E-5
Output for 7.0.10
1.9073486328125E-5 8.1062316894531E-6
Output for 7.0.9
2.4080276489258E-5 1.0013580322266E-5
Output for 7.0.8
2.0980834960938E-5 1.0013580322266E-5
Output for 7.0.7
1.978874206543E-5 9.0599060058594E-6
Output for 7.0.6
2.1219253540039E-5 2.5033950805664E-5
Output for 7.0.3, 7.0.5
2.1934509277344E-5 2.598762512207E-5
Output for 7.0.4
2.2172927856445E-5 2.5033950805664E-5
Output for 7.0.2
3.2186508178711E-5 2.3841857910156E-5
Output for 7.0.1
4.2915344238281E-5 3.504753112793E-5
Output for 7.0.0
2.7894973754883E-5 3.0994415283203E-5
Output for 5.6.28
7.8916549682617E-5 4.0054321289062E-5
Output for 5.6.25
3.7908554077148E-5 1.9073486328125E-5
Output for 5.6.24
7.1048736572266E-5 3.6001205444336E-5
Output for 5.6.23
0.0001680850982666 5.2928924560547E-5
Output for 5.5.32, 5.5.36, 5.6.22
4.6014785766602E-5 2.288818359375E-5
Output for 5.6.21
5.1021575927734E-5 2.4795532226562E-5
Output for 5.6.20
5.2928924560547E-5 2.598762512207E-5
Output for 5.5.37, 5.6.18 - 5.6.19
4.5061111450195E-5 2.1934509277344E-5
Output for 5.6.17
7.3909759521484E-5 3.4093856811523E-5
Output for 5.6.16
7.4863433837891E-5 3.0040740966797E-5
Output for 5.4.2, 5.6.15
7.2956085205078E-5 3.6954879760742E-5
Output for 5.6.14
5.8889389038086E-5 2.8848648071289E-5
Output for 5.6.13
6.6995620727539E-5 3.3855438232422E-5
Output for 5.6.12
5.2928924560547E-5 2.5033950805664E-5
Output for 5.6.11
5.4121017456055E-5 2.6941299438477E-5
Output for 5.6.10
5.9843063354492E-5 2.7894973754883E-5
Output for 5.6.9
6.6041946411133E-5 3.1948089599609E-5
Output for 5.6.8
5.8889389038086E-5 2.7894973754883E-5
Output for 5.6.7
7.3909759521484E-5 3.9100646972656E-5
Output for 5.4.7, 5.4.27, 5.4.45, 5.6.6
7.2956085205078E-5 3.6001205444336E-5
Output for 5.5.0, 5.6.5
7.1048736572266E-5 3.4093856811523E-5
Output for 5.6.4
6.2942504882812E-5 5.1975250244141E-5
Output for 5.6.3
6.6041946411133E-5 3.4093856811523E-5
Output for 5.6.2
6.1988830566406E-5 3.0040740966797E-5
Output for 5.6.1
7.3909759521484E-5 3.504753112793E-5
Output for 5.4.23, 5.6.0
6.6041946411133E-5 3.0994415283203E-5
Output for 5.5.33, 5.5.35, 5.5.38
4.5061111450195E-5 2.3126602172852E-5
Output for 5.5.31, 5.5.34
4.6014785766602E-5 2.3126602172852E-5
Output for 5.5.30
7.2002410888672E-5 3.504753112793E-5
Output for 5.4.24, 5.4.38, 5.5.29
6.2942504882812E-5 3.0994415283203E-5
Output for 5.5.28
5.9127807617188E-5 2.9087066650391E-5
Output for 5.5.27
5.6982040405273E-5 2.8133392333984E-5
Output for 5.5.26
0.00014090538024902 6.6995620727539E-5
Output for 5.5.25
6.6041946411133E-5 3.3855438232422E-5
Output for 5.4.30, 5.5.24
7.7009201049805E-5 3.7908554077148E-5
Output for 5.4.1, 5.4.5, 5.5.23
7.5101852416992E-5 3.6001205444336E-5
Output for 5.5.22
5.9843063354492E-5 2.288818359375E-5
Output for 5.5.21
8.1062316894531E-5 3.3855438232422E-5
Output for 5.4.19, 5.5.20
6.6995620727539E-5 3.2901763916016E-5
Output for 5.5.19
6.0081481933594E-5 2.9087066650391E-5
Output for 5.5.14, 5.5.18
6.6995620727539E-5 3.3140182495117E-5
Output for 5.5.16
9.608268737793E-5 3.7908554077148E-5
Output for 5.3.26, 5.4.10, 5.5.15
7.0095062255859E-5 3.504753112793E-5
Output for 5.5.13
7.4863433837891E-5 3.6954879760742E-5
Output for 5.5.12
6.5803527832031E-5 3.4809112548828E-5
Output for 5.5.11
6.8187713623047E-5 3.2901763916016E-5
Output for 5.5.10
4.8160552978516E-5 2.1934509277344E-5
Output for 5.5.9
7.6055526733398E-5 3.6954879760742E-5
Output for 5.5.8
5.6982040405273E-5 2.7894973754883E-5
Output for 5.5.7
7.6055526733398E-5 3.9100646972656E-5
Output for 5.5.6
7.4148178100586E-5 3.6001205444336E-5
Output for 5.4.35, 5.5.1, 5.5.5
7.4148178100586E-5 3.6954879760742E-5
Output for 5.5.4
7.5101852416992E-5 3.6954879760742E-5
Output for 5.5.3
5.7220458984375E-5 2.8848648071289E-5
Output for 5.4.41, 5.5.2
7.1048736572266E-5 3.504753112793E-5
Output for 5.4.9, 5.4.44
6.413459777832E-5 3.0994415283203E-5
Output for 5.4.43
6.0081481933594E-5 3.0040740966797E-5
Output for 5.4.42
6.6995620727539E-5 3.4093856811523E-5
Output for 5.4.40
7.7009201049805E-5 3.9100646972656E-5
Output for 5.4.39
7.7009201049805E-5 3.7193298339844E-5
Output for 5.4.13, 5.4.37
7.7962875366211E-5 3.814697265625E-5
Output for 5.4.36
7.0095062255859E-5 3.4093856811523E-5
Output for 5.4.34
7.8201293945312E-5 3.7908554077148E-5
Output for 5.4.32
6.5088272094727E-5 3.1948089599609E-5
Output for 5.4.31
7.2956085205078E-5 3.4809112548828E-5
Output for 5.3.14, 5.4.29
7.2002410888672E-5 3.6954879760742E-5
Output for 5.4.28
5.5789947509766E-5 2.7894973754883E-5
Output for 5.4.26
4.6014785766602E-5 2.1934509277344E-5
Output for 5.4.25
5.793571472168E-5 3.0040740966797E-5
Output for 5.4.14, 5.4.22
6.6041946411133E-5 3.3140182495117E-5
Output for 5.4.21
7.2002410888672E-5 3.4093856811523E-5
Output for 5.4.20
7.3909759521484E-5 3.0040740966797E-5
Output for 5.4.18
6.5088272094727E-5 2.8133392333984E-5
Output for 5.4.17
6.2942504882812E-5 3.1948089599609E-5
Output for 5.4.16
7.7009201049805E-5 3.6954879760742E-5
Output for 5.4.15
6.3896179199219E-5 3.0994415283203E-5
Output for 5.4.12
8.2015991210938E-5 5.4836273193359E-5
Output for 5.4.11
7.3909759521484E-5 3.7193298339844E-5
Output for 5.4.8
7.2002410888672E-5 3.6001205444336E-5
Output for 5.4.6
7.5817108154297E-5 3.6001205444336E-5
Output for 5.4.4
7.7009201049805E-5 3.814697265625E-5
Output for 5.4.3
5.9127807617188E-5 2.8848648071289E-5
Output for 5.4.0
7.6055526733398E-5 3.6001205444336E-5
Output for 5.3.29
5.0067901611328E-5 2.6941299438477E-5
Output for 5.3.24, 5.3.28
8.1062316894531E-5 4.1961669921875E-5
Output for 5.3.27
6.2942504882812E-5 3.3855438232422E-5
Output for 5.3.25
7.6055526733398E-5 4.2200088500977E-5
Output for 5.3.23
6.7949295043945E-5 3.504753112793E-5
Output for 5.3.22
0.0001370906829834 7.4148178100586E-5
Output for 5.3.21
6.6995620727539E-5 3.504753112793E-5
Output for 5.3.20
7.1048736572266E-5 3.7193298339844E-5
Output for 5.3.19
8.2015991210938E-5 4.0054321289062E-5
Output for 5.3.5, 5.3.18
8.0108642578125E-5 4.2915344238281E-5
Output for 5.3.17
7.6055526733398E-5 4.1007995605469E-5
Output for 5.3.16
7.8916549682617E-5 4.3153762817383E-5
Output for 5.3.15
7.1048736572266E-5 3.6954879760742E-5
Output for 5.3.13
6.3180923461914E-5 4.6968460083008E-5
Output for 5.3.12
8.2015991210938E-5 4.4107437133789E-5
Output for 5.3.11
7.2956085205078E-5 4.1007995605469E-5
Output for 5.3.10
6.413459777832E-5 3.3855438232422E-5
Output for 5.3.9
7.7962875366211E-5 4.4822692871094E-5
Output for 5.3.8
7.3909759521484E-5 4.2915344238281E-5
Output for 5.3.7
7.3909759521484E-5 4.1961669921875E-5
Output for 5.3.6
6.7949295043945E-5 3.6001205444336E-5
Output for 5.3.4
8.6069107055664E-5 4.4107437133789E-5
Output for 5.3.3
7.4148178100586E-5 3.7908554077148E-5
Output for 5.3.2
7.6055526733398E-5 4.0054321289062E-5
Output for 5.3.1
7.9154968261719E-5 4.3869018554688E-5
Output for 5.3.0
0.00010204315185547 4.4107437133789E-5
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/iK6nC on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/iK6nC on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/iK6nC on line 10
Process exited with code 255.