Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
The ++ operator in PHP - pre-increment and post-increment

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.

Associated topic - PHP - Control Statements

Next ... random image ... a slide show ... image from list below


© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho