示例#1
0
function test()
{
    $e = new Foo();
    try {
        throw new Exception("ops 2");
    } catch (Exception $e) {
        echo $e->getMessage() . "\n";
    }
}
示例#2
0
function main()
{
    // just checking it can be default-constructed...
    var_dump((new Foo())->getMessage());
    $junk = new Exception();
    $foo = new Foo('hello, world', 1337, $junk);
    var_dump($foo->getMessage());
    var_dump($foo->getCode());
    var_dump($foo->getPrevious() === $junk);
}