PHP Incrementing and Decrementing variables:
PHP follows very common style of increment and decrement, much like C,C++. but in few cases it follows Perl style, e.g. if we perform 'Z'+1 then PHP will display 'AA' whereas in 'C' and 'Java' result would be '['.
Examples:
<?php
$a
=12;echo
"Pre increment value of a is:".++$a."<br/>";echo
"Post increment value of a is:".$a++."<br/>";echo
"After post increment value of a is:".$a."<br/>";echo
"Pre decrement value of a is:".--$a."<br/>";echo
"Post decrement value of a is:".$a--."<br/>";echo
"After post decrement value of a is:".$a--."<br/>";?>
Output:
Pre increment value of a is:13
Post increment value of a is:13
After post increment value of a is:14
Pre decrement value of a is:13
Post decrement value of a is:13
After post decrement value of a is:12
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.