My stream of consciousness being a programmer.

Wednesday, December 21, 2011

PHP Incrementing & Decrementing Operators


Image result for plus and minus

What is the meaning of ++ increment operator and - – decrement operator and how can we use it ?

Below is a small explanation on what it does,

++$a means Pre-increment, It increments $a by one, then returns $a.

$a++ means Post-increment, It returns $a, then increments $a by one.

- – $a means Pre-decrement, It decrements $a by one, then returns $a.

$a – - means Post-decrement, It returns $a, then decrements $a by one.

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.