Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/ovningar/funktioner/
index.php
ovn_fn1 copy.php
ovn_fn1+2.php
ovn_fn3+4.php
ovn_fn5.php
ovn_fn6.php
ovn_fn7.php
ovn_fn5.php
34 lines ASCII 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="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Funktioner</title>
</head>
<body>
<?php
$arr = [1,2,3,4,5,6,7,8,9,100];
function getMean($arr){
$total = 0;
for ($i = 0; $i<count($arr);$i++){
$total += $arr[$i];
}
return($total/count($arr));
}
echo(getMean($arr));
?>
</body>
</html>