PHP supports C-style pre- and post-increment and decrement operators.
Table 10-4. Increment/decrement Operators
Here's a simple example script:
<?php echo "<h3>Postincrement</h3>"; $a = 5; echo "Should be 5: " . $a++ . "<br>\n"; echo "Should be 6: " . $a . "<br>\n"; echo "<h3>Preincrement</h3>"; $a = 5; echo "Should be 6: " . ++$a . "<br>\n"; echo "Should be 6: " . $a . "<br>\n"; echo "<h3>Postdecrement</h3>"; $a = 5; echo "Should be 5: " . $a-- . "<br>\n"; echo "Should be 4: " . $a . "<br>\n"; echo "<h3>Predecrement</h3>"; $a = 5; echo "Should be 4: " . --$a . "<br>\n"; echo "Should be 4: " . $a . "<br>\n"; ?>