- var_dump: documentation ( source)
- password_hash: documentation ( source)
- restore_error_handler: documentation ( source)
- set_error_handler: documentation ( source)
<?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);