| |||||||||||
| |||||||||||
The ++ operator in PHP - pre-increment and post-increment
![]()
Diagrams in class help us illustrate our lectures. In this example, we're showing how
the ++ operator in PHP (and it's the same in Perl) placed after a variable name uses
the variable for anything else in the context before it increments its target, whereas
placed before the target it increments first. We encourage trainees to experiment with
preincrement and postincrement during practicals on the PHP course, but you'll note that
we suggest a clearer alternative (using two statements) too. On our courses, we stress
the need to write good code that's easy to maintain and easy to follow - we're not saying
that the ++ operator is a bad thing, but we are saying that if it's used in a piece of
code that has to be maintained by an occasional PHP user, there's a clearer alternative.
Show a large image More about PHP resource index Associated topic - PHP - Control Statements |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||