PHP Scripting

Arithmetic Operations

learn PHP by example for basic arithmetic operations

5/18/2020
0 views
php-arithmetic-calculation.phpPHP
<?php
	/* initialization of variables */
	$a = 13;
	$b = 2;
	
	/* Calculation of Sum */
	$sum = $a + $b;
	
	/* Calculation of Subtract */
	$sub = $a - $b;
	
	/* Calculation of Multiplication */
	$mul = $a * $b;
	
	/* Calculation of Division */
	$div = $a / $b;
	
	/* Calculation of Modulus */
	$mod = $a % $b;
	
	echo "Sum: ".$sum;
	echo "<br />Subtract: ".$sub;
	echo "<br />Multiplication: ".$mul;
	echo "<br />Division: ".$div;
	echo "<br />Modulus: ".$mod;
?>




/* Output */
Sum: 15

Subtract: 11

Multiplication: 26

Division: 6.5

Modulus: 1
phpcalculation in phparithmetic operationsHypertext Preprocessor

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com

Arithmetic Operations - PHP | Geekboots