php-tutorialmade

PHP Percentage Calculator script

 

Are you looking to make your own PHP Percentage Calculator?, then you are at the right place.

What you will learn from this PHP script?

1. You will know how to divide a number in PHP.
2. You will learn how to multiply a number in PHP.
3. You will learn how to check a form is submitted in PHP.

What is the formula to find percentage of a number?

Formula: 
a% x b = c

Re-written the above formula for PHP:

Remove the % and divide by 100, then instead of x add *
c  =   (a / 100) * b

a – percentage value
b – number
c- answer

Here is the entire PHP script with the comments in it:

Read the comments in the above script to understand how the script works.

Here is the demo to see how the script works:

demo

 

Related Posts

4 thoughts on “PHP Percentage Calculator script

  1. Hi Agurchand, please can you help me modify this script to read values from database, calculate 1% of each of the values and store it in another table in the database. Am currently coding a daily profit calculation script for users, i expect to execute it using cron.

  2. You can enter the marks in the total subject field you want and edit the full marks accordingly, then calculate the percentage of the total marks.

Leave a Reply