Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/Grunder/

index.php
ovn_gr1.php
ovn_gr2.php
ovn_gr3.php
ovn_gr4.php
ovn_gr5.php
ovn_gr6.php
ovn_gr7.php

ovn_gr5.php

26 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>Document</title>
</head>
<body>
<?php


$array 
= [];
$tal = 1;

for (
$i = 0; $i < 10; $i++) {
    
$array[] = $tal;
    
$tal = $tal * 2;
}

$medel = array_sum($array) / 10;

echo 
"Medelvärdet är: " . $medel;

?>
</body>
</html>