17 lines
213 B
PHP
17 lines
213 B
PHP
<?php
|
|
|
|
$age = 17;
|
|
|
|
try {
|
|
|
|
if ($age > 18){
|
|
echo 'Old enough.';
|
|
} else {
|
|
throw new Exception('Not old enough');
|
|
}
|
|
} catch(Exception $ex){
|
|
echo 'Error: '. $ex -> getMessage();
|
|
}
|
|
|
|
|
|
?>
|