- var_dump: documentation ( source)
<?php
function test(Closure $test) {
try {
$test();
} catch (Throwable $e) {
var_dump([get_class($e) => $e->getMessage()]);
echo 'catch!', PHP_EOL;
}
}
test(function () { include __DIR__ . '/a.php'; });
test(function () { require __DIR__ . '/b.php'; });
echo 'done.' . PHP_EOL;