Originally posted by Zecc...
Just bumped against this code on my current project:
if($_REQUEST['discount_price'][$key] != 0) //avoid division by 0 { $value = floatval($_REQUEST['list_price'][$key]); $discount = - 100 + ($value * 100) / $value; $discount = round($discount, 2); } else $discount = 100;With discounts like these, I think I'll stick to the list price, thank you.
Hint: $_REQUEST can be used to access GET/POST variables and cookies.
Hint 2: Figure out what "-100 + (x * 100) / x" works out to.
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!