Created
August 30, 2021 03:51
-
-
Save gitllermopalafox/5b1bb942bfc916270a17ee83f7d7ec4f to your computer and use it in GitHub Desktop.
Calculate price for 2x1 promotions with PHP
This file contains hidden or 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
$price = 100; | |
$products = 9; | |
echo $price * $products/2 + ($products&1 ? $price/2 : 0); // 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment