Calculation

PHP Programming

PHP Programming Examples

<?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