28 Jan 2014

OPERATORS IN PHP :- Increment and Decrement operator

Incrementing and Decrementing operators are very widely used in most programming languages. They allow a PHP programmer to increment and decrement values as needed.
  1. Pre-Increment     ++$MyVariable  Result Increments $MyVariable by one.
  2. Post-Increment    $MyVariable++ Result Returns $MyVariable, then increments $myVar by one.
  3. Pre-Decrement    --$MyVariable  Result Decrements $MyVariable by one.
  4. Post-Decrement   $MyVariable-- Result Returns $MyVariable, then decrements $myVar by one.
example:-