Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/ovn_gr/

ovn_gr.php
ovn_gr1.php
ovn_gr2.php
ovn_gr3.php
ovn_gr4.php
ovn_gr5.php
ovn_gr6.php

ovn_gr4.php

43 lines ASCII Windows (CRLF)
<!DOCTYPE html>
<html>
<body>

<?php
echo "<p>";

$celsius = -20;
while (
$celsius <= 40) {
$fahrenheit = ($celsius 5) + 32;

echo 
"$celsius $fahrenheit<br>";

$celsius += 10;
}

echo 
"</p>";

$array = [];

for (
$i 0$i 7$i++) {
  
$celsius = ($i 2) * 10;
  
$fahrenheit = ($celsius 5) + 32;

  
$array[$i]["c"] = $celsius;
  
$array[$i]["f"] = $fahrenheit;
}

echo 
"<p>";
foreach (
$array as $i) {
  
$c $i["c"];
  
$f $i["f"];
echo 
"$c $f<br>";
}
echo 
"</p>";

echo 
"<p>".var_dump($array)."</p>";
echo 
"<p>".print_r($arraytrue)."</p>";
?> 

</body>
</html>