Foundations
Functions
Functions name reusable work and return values to the caller.
Functions
functions.php
<?php
function square($value) {
return $value * $value;
}
$side = ;
$area = square($side);
echo "side=" . $side . "\n";
echo "area=" . $area . "\n";
<?php
function square($value) {
return $value * $value;
}
$side = ;
$area = square($side);
echo "side=" . $side . "\n";
echo "area=" . $area . "\n";
<?php
function square($value) {
return $value * $value;
}
$side = ;
$area = square($side);
echo "side=" . $side . "\n";
echo "area=" . $area . "\n";
function call
A function call runs the named function and can use the returned value in another expression.