CSC220 fibonacci5.php

From dftwiki3
Jump to: navigation, search

--D. Thiebaut 23:29, 19 September 2010 (UTC)


<html>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<PRAGMA NO-CACHE>
<head>
<title>Php variables</title>
<body>
<div>

<?php
function displayEven( $i, $f ) {
   if ( $f % 2 == 0 )
     print "fib[$i] = $f <br>";
}


$fibN = 1;
$fibN_1 = 1;

for ( $count=2; $count<10; $count++ ) {
  $temp = $fibN + $fibN_1;
  $fibN_1 = $fibN;
  $fibN   = $temp;
  displayEven( $count, $fibN );
}

?>
</div>
</body>
</html>