Lokang 

PHP and MySQL

Increment and Decrement

In PHP, you can use the increment operator (++) to increase the value of a variable by 1, and the decrement operator (--) to decrease the value of a variable by 1.

The increment operator can be placed before or after the variable:

$x = 10;
$x++; // $x is now 11
++$x; // $x is now 12

The decrement operator can also be placed before or after the variable:

$x = 10;
$x--; // $x is now 9
--$x; // $x is now 8

You can use these operators to perform simple arithmetic operations, such as counting the number of times a loop has iterated:

for ($i = 0; $i < 10; $i++) {
   // do something
}

You can also use the increment and decrement operators in expressions:

$x = 10;
$y = ++$x + 5; // $y is 16
$x = 10;
$y = $x++ + 5; // $y is 15

In the first example, the value of $x is incremented before it is used in the expression, so $y is equal to $x + 5 after $x has been incremented. In the second example, the value of $x is used in the expression first, and then it is incremented, so $y is equal to $x + 5 before $x is incremented.