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 = 10000) { for ($i =0; $i < $cycles; $i++) { $closure(); } echo printf('Runns: %.6f', microtime(1) - $s); echo PHP_EOL; }; $print($test, microtime(1)); $print($test1, microtime(1));
Output for 7.1.0
Runns: 0.00139615 Runns: 0.00191515
Output for 7.0.14
Runns: 0.00170315 Runns: 0.00226015
Output for 7.0.6
Runns: 0.00118515 Runns: 0.00149315
Output for 7.0.5
Runns: 0.00122615 Runns: 0.00155015
Output for 7.0.4
Runns: 0.00102815 Runns: 0.00134215
Output for 7.0.3
Runns: 0.00099915 Runns: 0.00116815
Output for 7.0.2
Runns: 0.00105715 Runns: 0.00095315
Output for 7.0.1
Runns: 0.00081715 Runns: 0.00096315
Output for 7.0.0
Runns: 0.00122115 Runns: 0.00143915
Output for 5.6.28
Runns: 0.00662015 Runns: 0.00598415
Output for 5.6.21
Runns: 0.00614615 Runns: 0.00475515
Output for 5.6.20
Runns: 0.01092515 Runns: 0.00894815
Output for 5.6.19
Runns: 0.00627015 Runns: 0.00504215
Output for 5.6.18
Runns: 0.00471415 Runns: 0.00383315
Output for 5.6.17
Runns: 0.00374415 Runns: 0.00318415
Output for 5.6.16
Runns: 0.00522415 Runns: 0.00436015
Output for 5.6.15
Runns: 0.00526715 Runns: 0.00447715
Output for 5.6.14
Runns: 0.00533515 Runns: 0.00455915
Output for 5.6.13
Runns: 0.00562415 Runns: 0.00463315
Output for 5.6.12
Runns: 0.00602215 Runns: 0.00506715
Output for 5.6.11
Runns: 0.00387615 Runns: 0.00337715
Output for 5.6.10
Runns: 0.00636415 Runns: 0.00524015
Output for 5.6.9
Runns: 0.00570915 Runns: 0.00473915
Output for 5.6.8
Runns: 0.00516715 Runns: 0.00427315
Output for 5.6.7
Runns: 0.00582815 Runns: 0.00494415
Output for 5.5.35
Runns: 0.00569315 Runns: 0.00488715
Output for 5.5.34
Runns: 0.00374515 Runns: 0.00344915
Output for 5.5.33
Runns: 0.00381315 Runns: 0.00332015
Output for 5.5.32
Runns: 0.00334615 Runns: 0.00297415
Output for 5.5.31
Runns: 0.00379315 Runns: 0.00326715
Output for 5.5.30
Runns: 0.00615515 Runns: 0.00539915
Output for 5.5.29
Runns: 0.00644315 Runns: 0.00540115
Output for 5.5.28
Runns: 0.00558015 Runns: 0.00478415
Output for 5.5.27
Runns: 0.00598415 Runns: 0.00509715
Output for 5.5.26
Runns: 0.00455215 Runns: 0.00360215
Output for 5.5.25
Runns: 0.00611015 Runns: 0.00514515
Output for 5.5.24
Runns: 0.00414815 Runns: 0.00353015
Output for 5.4.45
Runns: 0.00327615 Runns: 0.00280715
Output for 5.4.44
Runns: 0.00372815 Runns: 0.00281815
Output for 5.4.43
Runns: 0.00323715 Runns: 0.00283215
Output for 5.4.42
Runns: 0.00348715 Runns: 0.00309115
Output for 5.4.41
Runns: 0.00463615 Runns: 0.00407115
Output for 5.4.40
Runns: 0.00623115 Runns: 0.00549615
Output for 5.4.39
Runns: 0.00398415 Runns: 0.00340315
Output for 5.4.38
Runns: 0.00490115 Runns: 0.00512415
Output for 5.4.37
Runns: 0.00345715 Runns: 0.00290715
Output for 5.4.36
Runns: 0.00407715 Runns: 0.00347215
Output for 5.4.35
Runns: 0.00405415 Runns: 0.00370015
Output for 5.4.34
Runns: 0.00329715 Runns: 0.00287915
Output for 5.4.32
Runns: 0.00420515 Runns: 0.00359215
Output for 5.4.31
Runns: 0.00326515 Runns: 0.00280915
Output for 5.4.30
Runns: 0.00523015 Runns: 0.00516615
Output for 5.4.29
Runns: 0.00351215 Runns: 0.00300515
Output for 5.4.28
Runns: 0.00411715 Runns: 0.00490015
Output for 5.4.27
Runns: 0.00495015 Runns: 0.00457015
Output for 5.4.26
Runns: 0.00413415 Runns: 0.00365515
Output for 5.4.25
Runns: 0.00456615 Runns: 0.00386415
Output for 5.4.24
Runns: 0.00473615 Runns: 0.00469315
Output for 5.4.23
Runns: 0.00477815 Runns: 0.00403415
Output for 5.4.22
Runns: 0.00334415 Runns: 0.00285615
Output for 5.4.21
Runns: 0.00494015 Runns: 0.00419015
Output for 5.4.20
Runns: 0.00349515 Runns: 0.00284515
Output for 5.4.19
Runns: 0.00369615 Runns: 0.00344115
Output for 5.4.18
Runns: 0.00410915 Runns: 0.00352415
Output for 5.4.17
Runns: 0.00485215 Runns: 0.00397815
Output for 5.4.16
Runns: 0.00461515 Runns: 0.00379215
Output for 5.4.15
Runns: 0.00334215 Runns: 0.00305815
Output for 5.4.14
Runns: 0.00375215 Runns: 0.00319615
Output for 5.4.13
Runns: 0.00329415 Runns: 0.00292415
Output for 5.4.12
Runns: 0.00573615 Runns: 0.00493915
Output for 5.4.11
Runns: 0.00354815 Runns: 0.00319015
Output for 5.4.10
Runns: 0.00326215 Runns: 0.00279315
Output for 5.4.9
Runns: 0.00331015 Runns: 0.00279815
Output for 5.4.8
Runns: 0.00510315 Runns: 0.00460115
Output for 5.4.7
Runns: 0.00485015 Runns: 0.00433415
Output for 5.4.6
Runns: 0.00495715 Runns: 0.00421015
Output for 5.4.5
Runns: 0.00486915 Runns: 0.00389015
Output for 5.4.4
Runns: 0.00321715 Runns: 0.00290915
Output for 5.4.3
Runns: 0.00420815 Runns: 0.00369115
Output for 5.4.2
Runns: 0.00452415 Runns: 0.00381215
Output for 5.4.1
Runns: 0.00407115 Runns: 0.00330115
Output for 5.4.0
Runns: 0.00500515 Runns: 0.00419815
Output for 5.3.29
Runns: 0.00509615 Runns: 0.00460415
Output for 5.3.28
Runns: 0.00393915 Runns: 0.00358715
Output for 5.3.27
Runns: 0.00508715 Runns: 0.00398315
Output for 5.3.26
Runns: 0.00387515 Runns: 0.00355715
Output for 5.3.25
Runns: 0.00467615 Runns: 0.00396315
Output for 5.3.24
Runns: 0.00561215 Runns: 0.00524315
Output for 5.3.23
Runns: 0.00468015 Runns: 0.00416615
Output for 5.3.22
Runns: 0.00397215 Runns: 0.00374215
Output for 5.3.21
Runns: 0.00449415 Runns: 0.00406215
Output for 5.3.20
Runns: 0.00589615 Runns: 0.00476715
Output for 5.3.19
Runns: 0.00455215 Runns: 0.00412715
Output for 5.3.18
Runns: 0.00600915 Runns: 0.00525515
Output for 5.3.17
Runns: 0.00618415 Runns: 0.00406415
Output for 5.3.16
Runns: 0.00622615 Runns: 0.00554715
Output for 5.3.15
Runns: 0.00530415 Runns: 0.00508215
Output for 5.3.14
Runns: 0.00596415 Runns: 0.00533015
Output for 5.3.13
Runns: 0.00393915 Runns: 0.00372115
Output for 5.3.12
Runns: 0.00506915 Runns: 0.00473915
Output for 5.3.11
Runns: 0.00396215 Runns: 0.00358515
Output for 5.3.10
Runns: 0.00521115 Runns: 0.00470315
Output for 5.3.9
Runns: 0.00392515 Runns: 0.00353715
Output for 5.3.8
Runns: 0.00597815 Runns: 0.00479815
Output for 5.3.7
Runns: 0.00603915 Runns: 0.00586015
Output for 5.3.6
Runns: 0.00583715 Runns: 0.00538315
Output for 5.3.5
Runns: 0.00582315 Runns: 0.00504115
Output for 5.3.4
Runns: 0.00585015 Runns: 0.00523515
Output for 5.3.3
Runns: 0.00425015 Runns: 0.00407915
Output for 5.3.2
Runns: 0.00510515 Runns: 0.00450715
Output for 5.3.1
Runns: 0.00591615 Runns: 0.00530115
Output for 5.3.0
Runns: 0.00453015 Runns: 0.00430715
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/AdN7j 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/AdN7j on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/AdN7j on line 3
Process exited with code 255.