3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
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.33
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 5.6.0 - 5.6.40
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.

preferences:
120.62 ms | 401 KiB | 157 Q