Mathematical Operations with Numbers in PHP
Addition:
<?php
$a = 1 + 2;
echo $a; // will output 3
?>
Subtraction:
<?php
$b = 3 - 2;
echo $b; // will output 1
?>
Multiplication:
<?php
$c = 3 * 2;
echo $c; // will output 6
?>
Division:
<?php
$d = 4 / 2;
echo $d; // will output 2
?>
Create a variable $a. Write the
sum of numbers 1, 2 and 3 into it.
Using the echo command, output the
contents of the variable $a to the screen.