lynxus Posted April 16, 2012 Share Posted April 16, 2012 Hi Guys, I have two values. 1) Number of users connected. ( Ex: 3456 ) 2) Number of users configured. ( Ex: 4100 ) How can I show this as a percentage. Ie: there are X% users connected. ( A percentage of the total configured ) Now, my maths is normally good but i just dont trust my workings lol. Ive been doing : $percent = $connected / $configured * 100; Thanks L Quote Link to comment https://forums.phpfreaks.com/topic/261036-percentage-between-two-numbers/ Share on other sites More sharing options...
AyKay47 Posted April 16, 2012 Share Posted April 16, 2012 $percent = ($connected / $configured) * 100; Quote Link to comment https://forums.phpfreaks.com/topic/261036-percentage-between-two-numbers/#findComment-1337804 Share on other sites More sharing options...
.josh Posted May 22, 2012 Share Posted May 22, 2012 Math works the same way here as it does on paper...technically in this case you don't even need to wrap anything in parens (though I usually do for better readability)...order of operations will have the division happen first... Quote Link to comment https://forums.phpfreaks.com/topic/261036-percentage-between-two-numbers/#findComment-1347822 Share on other sites More sharing options...
maxudaskin Posted August 10, 2012 Share Posted August 10, 2012 Math works the same way here as it does on paper...technically in this case you don't even need to wrap anything in parens (though I usually do for better readability)...order of operations will have the division happen first... You are correct. Quote Link to comment https://forums.phpfreaks.com/topic/261036-percentage-between-two-numbers/#findComment-1368454 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.