Created
September 1, 2019 04:58
-
-
Save earvinpiamonte/81d9196bc60fd9d3100508ff8fbebb1e to your computer and use it in GitHub Desktop.
Get discounted price in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$original_price = 25.90; | |
$discount_percentage = 4; | |
$discount_decimal = ($discount_percentage / 100); | |
$discount_price = $discount_decimal * $original_price; | |
$net_price = $original_price - $discount_price; | |
echo 'Discount decimal: '.$discount_decimal; | |
echo "</br>"; | |
echo 'Original price: '.$original_price; | |
echo "</br>"; | |
echo 'Discount price: '.$discount_price; | |
echo "</br>"; | |
echo 'Net price: '.$net_price; | |
echo "</br>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment