Canman2005 Posted March 31, 2007 Share Posted March 31, 2007 Hi all I have the following varibles <? $percent = 20; $total = 200; ?> Basically $percent is the percentage, such as 20% The total is the amount, such as 200 How can I deduct in php $percent from $total, so it would remove 20% from 200? Is this easy? Thanks in advance Dave Link to comment https://forums.phpfreaks.com/topic/45069-percentage/ Share on other sites More sharing options...
shocker-z Posted March 31, 2007 Share Posted March 31, 2007 <?php $percent = 20; $total = 200; $tmppercent=100-$percent; $equals=($total / 100 * $tmppercent); echo $equals; ?> This should do the trick for you Regards Liam Link to comment https://forums.phpfreaks.com/topic/45069-percentage/#findComment-218804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.