Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

public_html/exercises/

PHP_Functions.php
PHP_formular.php
PHP_inlcude.php
php_grunder.php

PHP_Functions.php

70 lines UTF-8 Windows (CRLF)
<?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>PHP Functions</title>
</head>
<body>
    
<h1>Hej Hallå</h1>
<h2>1.</h2>

<?php

function funktionen () {
    echo 
"Hejsvejs";
}

funktionen()

?>

<h2>2.</h2>

<?php

function  funkfunk ($antal) {
    for (
$i = 0; $i < $antal; $i++) {
        echo 
"hejsvejs <br>";
    }
}

funkfunk(10)

?>

<h2>3.</h2>

<?php

function storsta ($a, $b, $c) {
    if (
$a >= $b && $a >= $c) {
        return 
$a;
    }
    elseif (
$b >= $a && $b >= $c) {
        return 
$b;
    }
    else {
        return 
$c;
    }
}

$resultat = storsta(5589, 20034 ,72944);

echo 
$resultat;

?>

<h2>4.</h2>



</body>
</html>