CancelImage Upload

How to calculate a certain percentage of a number in PHP

If you are looking for the value of a specific percentage of a number in PHP all you need is some basic maths. For instance, if you want to find out 5% of 100, simply multiply 100 times .05. Here are a few examples to try out:

<?php

echo "10% of 100: ".(100 * 0.1)."<br><br>";

echo "20% of 100: ".(100 * 0.2)."<br><br>";

echo "50% of 100: ".(100 * 0.5)."<br><br>";

echo "5% of 100: ".(100 * 0.05)."<br><br>";

echo "0.5% of 100: ".(100 * 0.005)."<br><br>";

echo "150% of 100: ".(100 * 1.5)."<br><br>";

?>


Login
Want to leave a comment?

No problem. Just enter your email and password below.


register | home | reminder

myDesignTool Networking • www.mydesigntool.cominfo@mydesigntool.com