Returning a value from a function
<?
$number_to_display = number_format(285266237);
print "The population of the US is about: $number_to_display";
function myFunction($meal, $tax, $tip) {
$tax_amount = $meal * ($tax / 100);
$tip_amount = $meal * ($tip / 100);
$total_amount = $meal + $tax_amount + $tip_amount;
return $total_amount;
}
?>
Related examples in the same category