Webbserverprogrammering 1

Show sourcecode

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

webbserverprogrammering/exercises/funktioner/

ovning_1.php
ovning_2.php
ovning_3.php
ovning_4.php
ovning_5.php
ovning_6.php

ovning_4.php

28 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>Övning 4</title>
</head>
<body>
  <?php
    $tal1 
= 55;
    
$tal2 = 849;
    
$tal3 = 4;

    function 
searchNumbers($x, $y, $z, $sortType){

      if(
$sortType == "min" || $sortType == 'minsta'){
        return 
min($x, $y, $z);
      } else{
        return 
max($x, $y, $z);
      }
    }

    
$highest = searchNumbers($tal1, $tal2, $tal3, "min");

    echo 
"Minsta talet är: $highest";
  
?>
</body>
</html>