Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/repetition/

hemligheter.php
repetition.php
repetition1.php
repetition2.php
repetition3.php
repetition3_medel.php
repetition4.php
repetition5.php
repetition6.php
repetition7.php
repetition8.php

repetition1.php

27 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>Repetition</title>
</head>
<body>
  <?php
  $array 
= array();

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

  echo 
"Meddelvärdet av talen ";

  
$avg 0;
  foreach(
$array as $n) {
    
$avg += $n count($array);
    echo 
"$n, ";
  }

  echo 
"är <b>$avg</b>";
  
?>
</body>
</html>