Incrementing/Decrementing OperatorsPHP supports C-style pre- and post-increment and decrement operators.
Here's a simple example script:
<?php PHP follows Perl's convention when dealing with arithmetic operations on character variables and not C's. For example, in PHP and Perl $a = 'Z'; $a++; turns $a into 'AA', while in C a = 'Z'; a++; turns a into '[' (ASCII value of 'Z' is 90, ASCII value of '[' is 91). Note that character variables can be incremented but not decremented and even so only plain ASCII alphabets and digits (a-z, A-Z and 0-9) are supported. Incrementing/decrementing other character variables has no effect, the original string is unchanged. Example #1 Arithmetic Operations on Character Variables
<?php The above example will output: == Characters == X Y Z AA AB AC == Digits == A9 B0 B1 B2 B3 B4 A09 A10 A11 A12 A13 A14 Incrementing or decrementing booleans has no effect. |