moisesbr Posted August 1, 2013 Share Posted August 1, 2013 (edited) How to apply a discount porcentage using php ? e.g 10% Please, I would like a sample to get price from price_table, show in html, and replace it in order_table.The discount must not be applye to table: price_table Moises Edited August 1, 2013 by moisesbr Quote Link to comment https://forums.phpfreaks.com/topic/280731-discount-porcentage/ Share on other sites More sharing options...
requinix Posted August 1, 2013 Share Posted August 1, 2013 How to apply a discount porcentage using php ? original price * (1 - discount as a decimal figure) e.g 10% original price * (1 - 0.10) Please, I would like a sample to get price from price_table, show in html, and replace it in order_table. The discount must not be applye to table: price_table I don't know what you're talking about. Try writing a detailed explanation of what you're doing. And post the code you've written so far. And make sure to mention exactly how it doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/280731-discount-porcentage/#findComment-1443056 Share on other sites More sharing options...
moisesbr Posted August 2, 2013 Author Share Posted August 2, 2013 I tried: $my_price = $my_price - ($my_price * (10 / 100)) But it does not display 2 decimal digits. For eg. displays: 89.1 . Expected: 89.10 Quote Link to comment https://forums.phpfreaks.com/topic/280731-discount-porcentage/#findComment-1443065 Share on other sites More sharing options...
kicken Posted August 2, 2013 Share Posted August 2, 2013 number_format Quote Link to comment https://forums.phpfreaks.com/topic/280731-discount-porcentage/#findComment-1443067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.