klas 5/P2/phpserver/H7/7.4.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
$antwoord = omzetten (37, 'boe');
echo ("Dit is gelijk aan $antwoord graden.");
function omzetten ($graden, $omzetting_vanaf){
if ($omzetting =='fahrenheit'){
$celsius = ($graden-32)/1.8;
return $celsius;
}
elseif ($omzetting == 'celsius'){
$fahrenheit = ($graden * (9/5))+ 32;
return $fahrenheit;
}
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse