3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = function($p = 'abcde', $c = 'abc') { return substr($p, 0, strlen($c)) == $c, true); }; $test1 = function($p = 'abcde', $c = 'abc') { return strncmp($p, $c, strlen($c)); }; $print = function($closure, $s, $cycles = 100) { for ($i =0; $i < $cycles; $i++) { $closure(); } echo printf('Runns: %s', microtime(1) - $s); echo PHP_EOL; }; $print($test, microtime(1)); $print($test1, microtime(1));
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.20, 5.5.0 - 5.5.4
Parse error: syntax error, unexpected ',' in /in/79ijj on line 5
Process exited with code 255.

preferences:
189.56 ms | 1399 KiB | 61 Q