php2go/fixtures/0008-try-catch-finally.php

17 lines
301 B
PHP

<?php
function Foo(): int {
throw new \Exception('error');
return 0;
}
try {
Foo();
} catch (\BarException | \BazException $e) {
echo "bar or baz exception " . $e->getMessage() . "\n";
} catch (\Exception $e) {
echo "other exception " . $e->getMessage() . "\n";
} finally {
echo "finally";
}