Created
October 29, 2022 17:45
-
-
Save saaeiddev/d68c9f171f183e26617692a8a7d13c13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try{ | |
$x = 0; | |
$y = Inverse($x); | |
echo "The Inverse Of $x is $y"; | |
}catch (Exception $e){ | |
$y = "Undefined"; | |
}finally{ | |
echo "The Inverse Of $x is $y"; | |
} | |
function Inverse($x){ | |
if($x == 0){ | |
throw new Exception("Division by Zero."); | |
} | |
return 1/$x; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment