seany123 Posted January 29, 2009 Share Posted January 29, 2009 okay so i have 2 values. awake and maxawake. awake can be anything from 0 - 10,000 (10,000 depends on the maxawake) maxawake can be anything from 100 - 10,000. so i wanna know how to work out what percentage awake is against maxawake. so say awake was 100 and max awake was 10,000. awakes would be 1% of 10,000. how can this be worked out in php??? Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/ Share on other sites More sharing options...
rhodesa Posted January 29, 2009 Share Posted January 29, 2009 really?? print ($awake / $maxawake * 100) . '%'; Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-749629 Share on other sites More sharing options...
seany123 Posted January 29, 2009 Author Share Posted January 29, 2009 how can i be done so instead it showing... say 1%, it says 99% needed. if you get what i mean. Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-749738 Share on other sites More sharing options...
trq Posted January 29, 2009 Share Posted January 29, 2009 print 100 - ($awake / $maxawake * 100) . '%'; Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-749748 Share on other sites More sharing options...
seany123 Posted January 29, 2009 Author Share Posted January 29, 2009 thanks... i dunno why i couldnt do this myself... just being a bit of a noob really cheers Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-749773 Share on other sites More sharing options...
Daniel0 Posted January 29, 2009 Share Posted January 29, 2009 I don't mean to sound condescending or anything, but how did you work it out in hand then? Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-750049 Share on other sites More sharing options...
seany123 Posted January 31, 2009 Author Share Posted January 31, 2009 what do you mean work in out in hand? Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-751051 Share on other sites More sharing options...
corbin Posted January 31, 2009 Share Posted January 31, 2009 He meant "by hand." He wanted to know how you knew 1% of 10,000 is 100, but you didn't know how to figure stuff like that in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-751057 Share on other sites More sharing options...
seany123 Posted January 31, 2009 Author Share Posted January 31, 2009 the answer is simple... i was tired and obviously wasnt think correctly. im fairly clever when it comes to maths, but its when trying to put maths and php together things get slightly harder. Quote Link to comment https://forums.phpfreaks.com/topic/142968-solved-getting-the-of-something/#findComment-751628 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.