3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class Executor { public function execute(callable $function) { set_error_handler([$this, 'errorHandler']); var_dump($function()); restore_error_handler(); } private function errorHandler(int $type, string $message, string $file, int $line): bool { return true; } private function restoreErrorHandler(): void { } } $cb = function() { return password_hash(1234); }; (new Executor())->execute($cb);
based on I6mRD
Output for 7.1.0 - 7.3.0beta1
Fatal error: Uncaught ArgumentCountError: password_hash() expects at least 2 parameters, 1 given in /in/Dc2m2:26 Stack trace: #0 /in/Dc2m2(26): password_hash(1234) #1 /in/Dc2m2(9): {closure}() #2 /in/Dc2m2(29): Executor->execute(Object(Closure)) #3 {main} thrown in /in/Dc2m2 on line 26
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: password_hash() expects at least 2 parameters, 1 given in /in/Dc2m2:26 Stack trace: #0 /in/Dc2m2(26): password_hash(1234) #1 /in/Dc2m2(9): {closure}() #2 /in/Dc2m2(29): Executor->execute(Object(Closure)) #3 {main} thrown in /in/Dc2m2 on line 26
Process exited with code 255.
Output for hhvm-3.18.4 - 3.21.0
Warning: Invalid argument: function: method 'errorHandler' not found in /in/Dc2m2 on line 26 Fatal error: Uncaught TypeError: Argument 1 to password_hash() must be of type ?string, int given in /in/Dc2m2:26 Stack trace: #0 /in/Dc2m2(26): password_hash() #1 /in/Dc2m2(9): Closure$() #2 /in/Dc2m2(29): Executor->execute() #3 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/Dc2m2 on line 1 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/Dc2m2 on line 14
Process exited with code 255.