Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $item_price = 60.00;
- $quantity = 2;
- //sum total
- $total_price = $item_price * $quantity;
- //check discount
- if ($total_price >= 100 ) {
- //calculate 10% discount
- $subtotal = $total_price * 0.10;
- //calculate total after discount
- $total_price_after_discount = $total_price - $subtotal;
- echo 'Harga selepas diskaun :' . $total_price_after_discount;
- }else{
- echo 'Tiada diskaun harga:' . $total_price;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement