Difference between revisions of "CSC220 fibonacci5.php"
(Created page with '--~~~~ ---- <code><pre> <html> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <PRAGMA NO-CACHE> <head> <title>Php variables</title> <body> <div> <?php function displayEv…') |
|||
Line 2: | Line 2: | ||
---- | ---- | ||
− | < | + | <source type="php"> |
<html> | <html> | ||
Line 33: | Line 33: | ||
</body> | </body> | ||
</html> | </html> | ||
− | </ | + | </source> |
<br /> | <br /> |
Revision as of 18:29, 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>