Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/grunder/

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

ovn_gr6.php

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

<?php
$primList 
= array();

for(
$i=2$i<=100$i+=1){
 
$isPrime true;
 for(
$n=2$n<=sqrt($i); $n+=1) {
     if(
$i $n == 0) {
   
$isPrime false;
            break;
        
        }
        
  }
 if (
$isPrime == true) {
     
$primList[] = $i;
  }
}
echo 
"<pre>" print_r($primListtrue) . "</pre>";


?> 

</body>
</html>