Add exams from exam156 to exam199
This commit is contained in:
12
exam185/throwEx.php
Normal file
12
exam185/throwEx.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
function divide($num1, $num2){
|
||||
if($num2 == 0){
|
||||
throw new Exception('Cannot devide by 0');
|
||||
} else {
|
||||
return $num1/$num2;
|
||||
}
|
||||
}
|
||||
|
||||
echo divide(10,0);
|
||||
?>
|
||||
Reference in New Issue
Block a user