some stuff for the chapter on functions
This commit is contained in:
parent
9dab7bf8d7
commit
da075b76ba
30
docroot/html/functions.php
Normal file
30
docroot/html/functions.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once("_head.php");
|
||||||
|
|
||||||
|
mkheader("functions!", "#fafafa");
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- ======================================================= -->
|
||||||
|
<pre><?php
|
||||||
|
|
||||||
|
function sum($this, $other=5) {
|
||||||
|
return $this + $other;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "I am human, I am.\n";
|
||||||
|
|
||||||
|
$a = $_GET['a'] ? $_GET['a'] : 72 ;
|
||||||
|
|
||||||
|
print "$a plus 5 is " . sum($a, 5) . ".\n";
|
||||||
|
|
||||||
|
print "$a plus 5 is " . sum($a) . ".\n";
|
||||||
|
|
||||||
|
?></pre>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user