- var_dump: documentation ( source)
<?php
class Handler {
public function handle($exception)
{
var_dump($exception->getTrace()[0]);
}
}
class Foo {
public function bar($baz)
{
throw new Exception($baz);
}
}
try {
(new Foo)->bar('this is the argument');
} catch (Exception $exception) {
$handler = new Handler();
$handler->handle($exception);
}