How to Increment / Decrement a Number with PHP

1 · Josh Sherman · Aug. 23, 2013, midnight
Incrementing and decrementing a variable can be accomplished with C-style pre- and post-operators. The pre-operators return the value after it as been incremented or decremented, post- return the value before. Let’s take a look at incrementing first: $i = 1; echo ++$i; // outputs 2 echo $i++; // also outputs......