Hello i have problem, i want to my php script calculate percent of ex.
row 1 have ‘dmg’ value ‘62’ row 2 have ‘dmg’ value ‘38’
now, script need sto calculate this etc:
row 1 is: 62% of total ‘dmg’
and row 2 is: 38%
the percent need to be max. 100% ex. ‘dmg’ of row 1 can be 6200 and ‘dmg’ of row 2 can be 3800 but percent need to be 100% max…
any help? i tryed scripts but no one helps … thanks!! try.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi! Your question is a little unclear. In php you can calculate a percentage like you normally would. For instance, 3000 is 48.39% of 6200:
# php -a
php > $n = 3000;
php > echo (($n / 6200) * 100)."\n";
48.387096774194
Maybe if you could be more specific about the problem you’re facing, we can help you better.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.