Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/funktioner/

funktioner1.php
funktioner2.php
funktioner3.php
funktioner4.php
funktioner5.php
funktioner6.php
funktioner7.php
funktioner8.php
funktioner9.php

funktioner4.php

22 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>största eller minsta tal</title>
</head>
<body>
    <?php
    
function storstaTalet($tal1, $tal2, $tal3, $val = "storsta") {
        if (
$val === "minsta") {
            return 
min($tal1, $tal2, $tal3);
        }

        return 
max($tal1, $tal2, $tal3);
    }

    
$resultat = storstaTalet(4, 9, 6, "minsta");
    echo 
$resultat;
    
?>
</body>
</html>