Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/261036-percentage-between-two-numbers/
Share on other sites

  • 1 month later...
  • 2 months later...

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.