Difference between revisions of "CSC220 fibonacci5.php"
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
---- | ---- | ||
− | <source | + | <source lang="php"> |
<html> | <html> |
Latest revision as of 18:30, 19 September 2010
--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>