Voll Upload SGD Fachinformatiker PHP
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
if (isset($_GET['a']) && isset($_GET['b'])) {
|
||||
$a = $_GET['a'];
|
||||
$b = $_GET['b'];
|
||||
echo "Versuch der Division zweier Zahlen.<br>" . "Werfen einer Ausnahme, " . "wenn Division durch 0 zu teilen.<hr> ";
|
||||
try {
|
||||
|
||||
if ($b == 0)
|
||||
throw new Exception("<hr>Keine Division durch 0 erlaubt<hr>");
|
||||
echo $a / $b . "<br>";
|
||||
} catch(Exception $e) {
|
||||
print_r($e);
|
||||
}
|
||||
|
||||
echo "<hr>Nach dem potenziellen Problem. ";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form >
|
||||
Wert 1: <input name="a"><br>
|
||||
Wert 2: <input name="b"><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
Reference in New Issue
Block a user