note 28384 deleted from language.operators by derick

From: Date: Sun, 09 Nov 2003 12:12:36 +0000
Subject: note 28384 deleted from language.operators by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-60163@lists.php.net to get a copy of this message
Note Submitter: jlsalinas@NOSPAM.gmx.net ---- It looks like a lot of people don't really understand what's an operator (probably they come from the HTML field). An operator is something that you feed with one or more values (or expressions in the programing jargon) and yields another value (so that the construction itself becomes an expression). So you can think of functions or constructions that return a value (like print) as operators and those that return nothing (like echo) as any other thing. This relates to the ternary operator, ?:, as well. It should be used to select between two expressions depending on a third one, not to select two sentences or paths of execution. And always sorrounding ?: expressions with parenthesis is also a very good idea. As I've had to program in a variety of languages, I've got used to use parenthesis everywhere, and it's really worth it. They are only two kesystrokes, but they can save you a lot of headaches. I hope this will be useful to those of you who have to dive into PHP without a good programming ground. Don't desperate, it's really easy, and even a joy! ;)

« previous php.notes (#60163) next »