Below is an example of two simple functions:
<?php
function examplefunction ()
{
print "Hi, I'm a Function <br>";
}
function sqr( $num )
{
$NumSqr = $num * $num;
return $NumSqr;
}
Print "Sample Line 1 <br>";
examplefunction();
Print "Sample Line 3 <br>";
$a = 9;
$b = sqr( $a );
Print $a . "^2 = " . $b;
?> As you can see above, the code we defined between the { and } is all executed when we call the function below. In our first example (examplefunction) we used the function to simply print text. In our second function (sqr) we needed an operand to complete the math within the function. We put this inside the parenthesis () after the function name. We then add in the RETURN line, so that the value is outputted to the spot in the code where we originally called the function.

