3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = range(0, 10000); $time = microtime(true); $b = array_filter($a, function($el) { return $el % 2 === 0; }); var_dump(microtime(true) - $time); $b = []; $time = microtime(true); foreach ($a as $el) { if ($el % 2 === 0) { $b[] = $el; } } var_dump($time - microtime(true));
Output for 7.1.0
float(0.00095009803771973) float(-0.00049710273742676)
Output for 7.0.14
float(0.00099802017211914) float(-0.00049901008605957)
Output for 7.0.12
float(0.00086498260498047) float(-0.00041103363037109)
Output for 7.0.6
float(0.0014259815216064) float(-0.00044798851013184)
Output for 7.0.5
float(0.001183032989502) float(-0.00036311149597168)
Output for 7.0.4
float(0.0011470317840576) float(-0.00040817260742188)
Output for 7.0.3
float(0.0010099411010742) float(-0.00034618377685547)
Output for 7.0.2
float(0.0010638236999512) float(-0.0003969669342041)
Output for 7.0.1
float(0.0015230178833008) float(-0.00036406517028809)
Output for 7.0.0
float(0.00077700614929199) float(-0.00028300285339355)
Output for 5.6.28
float(0.002877950668335) float(-0.0011651515960693)
Output for 5.6.21
float(0.0027768611907959) float(-0.0011088848114014)
Output for 5.6.20
float(0.0016889572143555) float(-0.00070619583129883)
Output for 5.6.19
float(0.0017390251159668) float(-0.00070500373840332)
Output for 5.6.18
float(0.0017259120941162) float(-0.00069189071655273)
Output for 5.6.17
float(0.0024709701538086) float(-0.00095391273498535)
Output for 5.6.16
float(0.0028932094573975) float(-0.0010731220245361)
Output for 5.6.15
float(0.0024950504302979) float(-0.0010290145874023)
Output for 5.6.14
float(0.0026938915252686) float(-0.0010800361633301)
Output for 5.6.13
float(0.002593994140625) float(-0.0010230541229248)
Output for 5.6.12
float(0.0030558109283447) float(-0.00080204010009766)
Output for 5.6.11
float(0.0022330284118652) float(-0.00088214874267578)
Output for 5.6.10
float(0.0017690658569336) float(-0.00075507164001465)
Output for 5.6.9
float(0.0024609565734863) float(-0.0009620189666748)
Output for 5.6.8
float(0.0027680397033691) float(-0.0010921955108643)
Output for 5.5.35
float(0.0041980743408203) float(-0.0016269683837891)
Output for 5.5.34
float(0.0028500556945801) float(-0.00092101097106934)
Output for 5.5.33
float(0.0025870800018311) float(-0.0010430812835693)
Output for 5.5.32
float(0.0024020671844482) float(-0.0010349750518799)
Output for 5.5.31
float(0.002230167388916) float(-0.001011848449707)
Output for 5.5.30
float(0.0016739368438721) float(-0.00071811676025391)
Output for 5.5.29
float(0.0018298625946045) float(-0.00077009201049805)
Output for 5.5.28
float(0.002187967300415) float(-0.0008549690246582)
Output for 5.5.27
float(0.0023410320281982) float(-0.00095295906066895)
Output for 5.5.26
float(0.0023081302642822) float(-0.00095915794372559)
Output for 5.5.25
float(0.0024328231811523) float(-0.0010230541229248)
Output for 5.5.24
float(0.0021159648895264) float(-0.00087785720825195)
Output for 5.4.45
float(0.0016260147094727) float(-0.00071096420288086)
Output for 5.4.44
float(0.0016539096832275) float(-0.00069785118103027)
Output for 5.4.43
float(0.0018470287322998) float(-0.00070810317993164)
Output for 5.4.42
float(0.0021140575408936) float(-0.00082492828369141)
Output for 5.4.41
float(0.0015890598297119) float(-0.00069499015808105)
Output for 5.4.40
float(0.001629114151001) float(-0.00068807601928711)
Output for 5.4.39
float(0.0020370483398438) float(-0.00086498260498047)
Output for 5.4.38
float(0.0016028881072998) float(-0.00067710876464844)
Output for 5.4.37
float(0.0022580623626709) float(-0.00096511840820312)
Output for 5.4.36
float(0.0023379325866699) float(-0.00098395347595215)
Output for 5.4.35
float(0.0022890567779541) float(-0.00097084045410156)
Output for 5.4.34
float(0.0016748905181885) float(-0.00068998336791992)
Output for 5.4.32
float(0.0027401447296143) float(-0.001093864440918)
Output for 5.4.31
float(0.0019540786743164) float(-0.00098490715026855)
Output for 5.4.30
float(0.0026929378509521) float(-0.0011341571807861)
Output for 5.4.29
float(0.0018789768218994) float(-0.0009770393371582)
Output for 5.4.28
float(0.0026199817657471) float(-0.0011088848114014)
Output for 5.4.27
float(0.0023009777069092) float(-0.00096297264099121)
Output for 5.4.26
float(0.0031800270080566) float(-0.0012650489807129)
Output for 5.4.25
float(0.0031919479370117) float(-0.00092792510986328)
Output for 5.4.24
float(0.0025238990783691) float(-0.0010318756103516)
Output for 5.4.23
float(0.0027151107788086) float(-0.0011880397796631)
Output for 5.4.22
float(0.0026390552520752) float(-0.00099992752075195)
Output for 5.4.21
float(0.0024950504302979) float(-0.0011489391326904)
Output for 5.4.20
float(0.0026330947875977) float(-0.0011391639709473)
Output for 5.4.19
float(0.0027639865875244) float(-0.0011329650878906)
Output for 5.4.18
float(0.0025229454040527) float(-0.0011348724365234)
Output for 5.4.17
float(0.0017449855804443) float(-0.00070595741271973)
Output for 5.4.16
float(0.0027768611907959) float(-0.0012772083282471)
Output for 5.4.15
float(0.0027799606323242) float(-0.0011630058288574)
Output for 5.4.14
float(0.002208948135376) float(-0.00095105171203613)
Output for 5.4.13
float(0.0027668476104736) float(-0.0011608600616455)
Output for 5.4.12
float(0.0024271011352539) float(-0.0010011196136475)
Output for 5.4.11
float(0.0037250518798828) float(-0.0014579296112061)
Output for 5.4.10
float(0.0021810531616211) float(-0.00093388557434082)
Output for 5.4.9
float(0.0027389526367188) float(-0.0012359619140625)
Output for 5.4.8
float(0.0022358894348145) float(-0.00086307525634766)
Output for 5.4.7
float(0.0019819736480713) float(-0.00084209442138672)
Output for 5.4.6
float(0.0026130676269531) float(-0.0010161399841309)
Output for 5.4.5
float(0.0022451877593994) float(-0.00090599060058594)
Output for 5.4.4
float(0.0025758743286133) float(-0.00092911720275879)
Output for 5.4.3
float(0.0022611618041992) float(-0.00089693069458008)
Output for 5.4.2
float(0.0025908946990967) float(-0.0013000965118408)
Output for 5.4.1
float(0.0023109912872314) float(-0.0009610652923584)
Output for 5.4.0
float(0.0023379325866699) float(-0.0010559558868408)
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/0RFlg on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/0RFlg on line 7
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 in /in/0RFlg on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/0RFlg on line 7
Process exited with code 255.