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
Parse error: syntax error, unexpected ',' in /in/kKdnJ on line 5
Process exited with code 255.

preferences:
174.58 ms | 1395 KiB | 56 Q