Re: ternary operators
| From: | Lukas Smith | Date: | Tue, 04 Jan 2005 08:18:55 +0000 |
| Subject: | Re: ternary operators | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35326@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
On Tue, 04 Jan 2005 07:36:52 +0100, Matthieu MARY <marym@ifrance.com> wrote:Generally readability should prevail over number of characters. I like for sutff like this: $foo = $bar ? array() : false; This makes it much clearer that $foo is being set. if ($bar) { $foo = array(); } else { $foo = false; } is less clear in this situation. however one should refrain from nesting .. $foo = $bar ? array() : ($bar === false) ? false : null; regards, Lukashello list, and good year :) I have just a question about the ternary operators and their coding convention. I'd like to submit new package and according with coding convention, I would like to update my source code. but I can't found some informations about their coding convention what coding convention I need to use? thanks in advance for your helpThere was discussion a little while ago about CS and this was brought up. As I recall, there's no hard and fast rule on the use of the ternary operator.