Arithmetic operators work with:
integer
and
float
values to perform arithmetical operations. Let's define two variables:
number1
and
number2
and perform these operations
$number1 = 40;
$number2 = 9;
Addition
echo $number1 + $number2 . "\n";
Subtraction
echo $number1 - $number2 . "\n";
Multiplication
echo $number1 * $number2 . "\n";
Division
echo $number1 / $number2 . "\n";
Modulus
echo $number1 % $number2 . "\n";
by Valeri Tandilashvili
2 years ago
PHP
Operators
5
Pro tip: use ```triple backticks around text``` to write in code fences