Calculation in PHP

How we Calculate Numbers in PHP

The calculation is main part of any programming language. in PHP you can add, subtract , multiply and perform division of number. You can use the basic arithmetic operator + , - , * and / for calculation.
To add the contents of variables, you just separate each variable name with a plus symbol.
for example


<?php

$first_number=100;

$second_number=5;

echo $first_number + $second_number ;

?>

You can also calculate the direct values:
echo 10 + 20 + 30 ;
Or even this:
$number = 10;
echo $number + 30 ;
in this example we use * operator which is used for multiplication.


<?php

$first_number = 10;
$second_number = 20;
$third_number = 100;

$total = $third_number * $second_number * $first_number;

echo   $total  ;

?>