Example #1
0
<?php

require_once 'example-5-11.php';
function can_pay_cash($cash_on_hand, $amount)
{
    if ($amount > $cash_on_hand) {
        return false;
    } else {
        return true;
    }
}
$total = restaurant_check(15.22, 8.25, 15);
if (can_pay_cash(20, $total)) {
    print "I can pay in cash.";
} else {
    print "Time for the credit card.";
}
Example #2
0
<?php

require_once 'example-5-11.php';
if (restaurant_check(15.22, 8.25, 15) < 20) {
    print 'Less than $20, I can pay cash.';
} else {
    print 'Too expensive, I need my credit card.';
}