Jump to content

Archived

This topic is now archived and is closed to further replies.

Canman2005

php maths help

Recommended Posts

Hello everyone

I have a php page which prints two number values, one of the numbers is a percentage and the other is a total amount. It looks like;

Percentage: 22
Total: 500

Can PHP work out percentages? So my example would be

22% of 550

and then print out the toal on the page with the percentage deducted from the total? Tried a few ideas but cannot seem to get it to work

Any help would be ace

Thanks in advance

Mark

Share this post


Link to post
Share on other sites
$percentage = 22;
$total = 550;

echo $percentage."% of ".$total." is ".($total * $percentage/100 );

Share this post


Link to post
Share on other sites

×

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.