Numbers can be added, subtracted, multiplied, divided, put into variables, formatted, and so on.

Outcome :

Math in PHP follows the same precedence rules as regular math. BEDMAS. From most important to least important is :

Brackets Exponents Division Muliplication Addition Subtraction

Outcome :

A simple shortcut method may be used to add or subtract 1 from a number.

Outcome :

Can you guess what you would put to decrease a number by one? For those who are having a brain fuzzy :

Outcome :

<?php

$number = 10;

$number = $number + 1;

echo "$number";

?>

$number = 10;

$number = $number + 1;

echo "$number";

?>

Outcome :

11

Math in PHP follows the same precedence rules as regular math. BEDMAS. From most important to least important is :

Brackets Exponents Division Muliplication Addition Subtraction

<?php

$first_number = 10 - 4 / 2;

$second_number = (10 - 4) / 2;

echo "$first_number <br />";

echo "$second_number";

?>

$first_number = 10 - 4 / 2;

$second_number = (10 - 4) / 2;

echo "$first_number <br />";

echo "$second_number";

?>

Outcome :

8

3

3

A simple shortcut method may be used to add or subtract 1 from a number.

<?php

$number = 10;

$number++; // that is the same as saying $number=$number+1;

echo "$number";

?>

$number = 10;

$number++; // that is the same as saying $number=$number+1;

echo "$number";

?>

Outcome :

11

Can you guess what you would put to decrease a number by one? For those who are having a brain fuzzy :

<?php

$number = 10;

$number--; // that is the same as saying $number=$number-1;

echo "$number";

?>

$number = 10;

$number--; // that is the same as saying $number=$number-1;

echo "$number";

?>

Outcome :

9