Show sourcecode
The following files exists in this folder. Click to view.
PHP_Functions.php
PHP_formular.php
PHP_inlcude.php
php_grunder.php
php_grunder.php
84 lines UTF-8 Windows (CRLF)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
<?php
error_reporting(-1); // Report all type of errors
ini_set('display_errors', 1); // Display all errors
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
?>
<!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>
<h1>Hej Hallå</h1>
<h2>1.</h2>
<?php
$temp= 50;
$celsius= 5/9 * ( $temp - 32);
echo $celsius;
?>
<h2>2.</h2>
<?php
$text1 = "Kalle";
$enamn = "Anka";
$tal = 16;
$road = "Ankvägen";
echo $text1 . " ". $enamn . " bor på " . $road . " ". $tal
?>
<h2>3. a)</h2>
<?php
$summa = 0;
for ($i = 1; $i <= 100; $i++) {
$summa+= $i;
}
echo $summa;
?>
<h2>3. b)</h2>
<?php
$i = 0;
$summanavkardemumman = 0;
while ($i < 100) {
$i++;
$summanavkardemumman += $i;
}
echo $summanavkardemumman;
?>
<h2>4.</h2>
<?php
for ($i = -20; $i <= 40; $i += 10) {
echo $i . " ";
}
?>
</body>
</html>