3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $test = function($p = 'abcde', $c = 'abc') { return substr($p, 0, strlen($c)) == $c; }; $test1 = function($p = 'abcde', $c = 'abc') { return strncmp($p, $c, strlen($c)); }; $print = function($closure, $s, $cycles = 1000000) { for ($i =0; $i < $cycles; $i++) { $closure(); } echo printf('Runns: %.3f', microtime(1) - $s); echo PHP_EOL; }; $print($test, microtime(1)); $print($test1, microtime(1));
Output for 7.1.0
Runns: 0.11312 Runns: 0.12512
Output for 7.0.14
Runns: 0.13312 Runns: 0.12712
Output for 7.0.6
Runns: 0.10012 Runns: 0.09912
Output for 7.0.5
Runns: 0.08212 Runns: 0.10112
Output for 7.0.4
Runns: 0.08012 Runns: 0.09912
Output for 7.0.3
Runns: 0.08212 Runns: 0.09212
Output for 7.0.2
Runns: 0.09612 Runns: 0.09412
Output for 7.0.1
Runns: 0.09312 Runns: 0.09812
Output for 7.0.0
Runns: 0.12712 Runns: 0.12212
Output for 5.6.28
Runns: 0.40312 Runns: -0.06713
Output for 5.6.21
Runns: 0.36912 Runns: 0.31912
Output for 5.6.20
Runns: 0.39612 Runns: 0.32512
Output for 5.6.19
Runns: 0.32212 Runns: 0.26512
Output for 5.6.18
Runns: 0.35512 Runns: 0.30012
Output for 5.6.17
Runns: 0.39412 Runns: 0.33012
Output for 5.6.16
Runns: 0.37812 Runns: 0.32812
Output for 5.6.15
Runns: 0.39912 Runns: 0.32212
Output for 5.6.14
Runns: 0.39212 Runns: 0.32112
Output for 5.6.13
Runns: 0.38312 Runns: 0.32112
Output for 5.6.12
Runns: 0.41212 Runns: 0.31912
Output for 5.6.11
Runns: 0.38912 Runns: 0.32612
Output for 5.6.10
Runns: 0.40312 Runns: 0.32212
Output for 5.6.9
Runns: 0.37112 Runns: 0.32012
Output for 5.6.8
Runns: 0.39612 Runns: 0.32912
Output for 5.5.35
Runns: 0.40312 Runns: 0.33712
Output for 5.5.34
Runns: 0.39912 Runns: 0.34112
Output for 5.5.33
Runns: 0.33312 Runns: 0.28212
Output for 5.5.32
Runns: 0.38912 Runns: 0.33612
Output for 5.5.31
Runns: 0.40112 Runns: 0.33812
Output for 5.5.30
Runns: 0.38912 Runns: 0.33712
Output for 5.5.29
Runns: 0.39812 Runns: 0.34012
Output for 5.5.28
Runns: 0.40812 Runns: 0.33712
Output for 5.5.27
Runns: 0.39312 Runns: 0.33512
Output for 5.5.26
Runns: 0.41412 Runns: 0.34412
Output for 5.5.25
Runns: 0.38312 Runns: 0.33212
Output for 5.5.24
Runns: 0.41312 Runns: 0.33312
Output for 5.4.45
Runns: 0.28712 Runns: 0.27812
Output for 5.4.44
Runns: 0.29112 Runns: 0.27212
Output for 5.4.43
Runns: 0.35312 Runns: 0.27212
Output for 5.4.42
Runns: 0.32112 Runns: 0.24012
Output for 5.4.41
Runns: 0.31512 Runns: 0.34312
Output for 5.4.40
Runns: 0.37312 Runns: 0.30212
Output for 5.4.39
Runns: 0.38412 Runns: 0.29412
Output for 5.4.38
Runns: 0.80712 Runns: 0.60512
Output for 5.4.37
Runns: 0.66212 Runns: 0.53912
Output for 5.4.36
Runns: 0.67812 Runns: 0.73812
Output for 5.4.35
Runns: 1.08812 Runns: 0.78212
Output for 5.4.34
Runns: 0.71612 Runns: 0.64012
Output for 5.4.32
Runns: 0.42612 Runns: 0.38412
Output for 5.4.31
Runns: 0.40912 Runns: 0.39912
Output for 5.4.30
Runns: 0.41312 Runns: 0.40312
Output for 5.4.29
Runns: 0.44112 Runns: 0.38712
Output for 5.4.28
Runns: 0.42612 Runns: 0.39312
Output for 5.4.27
Runns: 0.47112 Runns: 0.38412
Output for 5.4.26
Runns: 0.51112 Runns: 0.38812
Output for 5.4.25
Runns: 0.47012 Runns: 0.39412
Output for 5.4.24
Runns: 0.55212 Runns: 0.37912
Output for 5.4.23
Runns: 0.43312 Runns: 0.39112
Output for 5.4.22
Runns: 0.42312 Runns: 0.40812
Output for 5.4.21
Runns: 0.44412 Runns: 0.39012
Output for 5.4.20
Runns: 0.45712 Runns: 0.40312
Output for 5.4.19
Runns: 0.52912 Runns: 0.44712
Output for 5.4.18
Runns: 0.55912 Runns: 0.44312
Output for 5.4.17
Runns: 0.58712 Runns: 0.46112
Output for 5.4.16
Runns: 0.55512 Runns: 0.45212
Output for 5.4.15
Runns: 0.53912 Runns: 0.49512
Output for 5.4.14
Runns: 0.48712 Runns: 0.49312
Output for 5.4.13
Runns: 0.47812 Runns: 0.43112
Output for 5.4.12
Runns: 0.50612 Runns: 0.47312
Output for 5.4.11
Runns: 0.45912 Runns: 0.47512
Output for 5.4.10
Runns: 0.46912 Runns: 0.41912
Output for 5.4.9
Runns: 0.47912 Runns: 0.47412
Output for 5.4.8
Runns: 0.51512 Runns: 0.53612
Output for 5.4.7
Runns: 0.49912 Runns: 0.46812
Output for 5.4.6
Runns: 0.53312 Runns: 0.49312
Output for 5.4.5
Runns: 0.51612 Runns: 0.43412
Output for 5.4.4
Runns: 0.57812 Runns: 0.43912
Output for 5.4.3
Runns: 0.58312 Runns: 0.50612
Output for 5.4.2
Runns: 0.60412 Runns: 0.44912
Output for 5.4.1
Runns: 0.63412 Runns: 0.48112
Output for 5.4.0
Runns: 0.54912 Runns: 0.51212
Output for 5.3.29
Runns: 0.49612 Runns: 0.47712
Output for 5.3.28
Runns: 0.52212 Runns: 0.47212
Output for 5.3.27
Runns: 0.70812 Runns: 0.63012
Output for 5.3.26
Runns: 0.65412 Runns: 0.63112
Output for 5.3.25
Runns: 0.65212 Runns: 0.63012
Output for 5.3.24
Runns: 0.66512 Runns: 0.61012
Output for 5.3.23
Runns: 0.66912 Runns: 0.55112
Output for 5.3.22
Runns: 0.61312 Runns: 0.54412
Output for 5.3.21
Runns: 0.62212 Runns: 0.60512
Output for 5.3.20
Runns: 0.63812 Runns: 0.51712
Output for 5.3.19
Runns: 0.64612 Runns: 0.59512
Output for 5.3.18
Runns: 0.60412 Runns: 0.57312
Output for 5.3.17
Runns: 0.60712 Runns: 0.58312
Output for 5.3.16
Runns: 0.63112 Runns: 0.54612
Output for 5.3.15
Runns: 0.67612 Runns: 0.55012
Output for 5.3.14
Runns: 0.64612 Runns: 0.61312
Output for 5.3.13
Runns: 0.58012 Runns: 0.54212
Output for 5.3.12
Runns: 0.60912 Runns: 0.52912
Output for 5.3.11
Runns: 0.58112 Runns: 0.53412
Output for 5.3.10
Runns: 0.67512 Runns: 0.60712
Output for 5.3.9
Runns: 0.59712 Runns: 0.58512
Output for 5.3.8
Runns: 0.56912 Runns: 0.50712
Output for 5.3.7
Runns: 0.55412 Runns: 0.51512
Output for 5.3.6
Runns: 0.60912 Runns: 0.52812
Output for 5.3.5
Runns: 0.57912 Runns: 0.63512
Output for 5.3.4
Runns: 0.58412 Runns: 0.50112
Output for 5.3.3
Runns: 0.54512 Runns: 0.51112
Output for 5.3.2
Runns: 0.64212 Runns: 0.51812
Output for 5.3.1
Runns: 0.60512 Runns: 0.55912
Output for 5.3.0
Runns: 0.63312 Runns: 0.52512
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/PvHfu on line 3
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/PvHfu on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/PvHfu on line 3
Process exited with code 255.