<?
function can_pay_cash($cash_on_hand, $amount) {
if ($amount > $cash_on_hand) {
return false;
} else {
return true;
}
}
function myFunction($meal, $tax, $tip) {
$tax_amount = $meal * ($tax / 100);
$tip_amount = $meal * ($tip / 100);
$total_notip = $meal + $tax_amount;
$total_tip = $meal + $tax_amount + $tip_amount;
return array($total_notip, $total_tip);
}
$total = myFunction(15.22,8.25,15);
if (can_pay_cash(20, $total)) {
print "I can pay in cash.";
} else {
print "Time for the credit card.";
}
?>
|