TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
404 B
23 lines
404 B
--TEST--
|
|
try catch
|
|
--FILE--
|
|
<?php
|
|
function inverse($x) {
|
|
return number_format(1.0 / $x, 2);
|
|
}
|
|
|
|
function main() {
|
|
try {
|
|
echo inverse(5.0) . "\n";
|
|
echo inverse(0) . "\n";
|
|
} catch (DivisionByZeroError $e) {
|
|
echo 'Caught exception: ', $e->getMessage(), "\n";
|
|
} finally {
|
|
echo "Finally\n";
|
|
}
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
0.20
|
|
Caught exception: Division by zero
|
|
Finally
|
|
|