The following are Incrementing/Decrementing Operators:

++$x Pre-increment Increments $x by one, then returns $x.
$x++ Post-increment Returns $x, then increments $x by one.
–$x Pre-decrement Decrements $x by one, then returns $x.
$x– Post-decrement Returns $x, then decrements $x by one.

Example1:
Code:

echo "postincrement";
$a = 5;
echo  $a++ . "
"; echo $a . "
";

Output:

postincrement
5
6

Example2:
Code:

echo "preincrement";
$a = 5;
echo  ++$a . "
"; echo $a . "
";

preincrement
6
6

Example3:
Code:

echo "Postdecrement";
$a  = 5;
echo  $a-- . "
"; echo $a . "
";

Postdecrement
5
4

Example4:
Code:

echo "Predecrement";
$a  = 5;
echo  --$a . "
"; echo $a . "
";

Output:

Predecrement
4
4

eXTReMe Tracker