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

17 lines
306 B
PHP

<?php
function Foo(): int {
throw new \Exception('error');
return 0;
}
try {
echo 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";
}