<!DOCTYPE html>
<html>
<body>
<?php
try {
$rand = rand(0, 2);
switch($rand) {
case 0: throw new Exception();
case 1: throw new OutOfBoundsException();
case 2: throw new LogicException();
}
} catch(OutOfBoundsException $e) {
echo "境界外の例外をキャッチ";
} catch(LogicException $e) {
echo "ロジックの例外をキャッチ";
} catch(Exception $e) {
echo "通常の例外をキャッチ";
}
?>
</body>
</html>