Simple calculator program in PHP
Here you will learn to create a simple calculator program in PHP language. We will perform the basic arithmetical operations like addition, subtraction, multiplication and division on the entered data.
Example of simple calculator program in PHP
1 2 3 4 5 6 7 8 9 | <?php $num1 = 10; $num2 = 5; echo "Addition: " . ($num1 + $num2) . "<br>"; echo "Subtraction: " . ($num1 - $num2) . "<br>"; echo "Multiplication: " . ($num1 * $num2) . "<br>"; echo "Division: " . ($num1 / $num2) . "<br>"; ?> |
Output
Addition: 15
Subtraction: 5
Multiplication: 50
Division: 2
Check our other PHP examples