"The ternary operator"
| From: | Ford, Mike | Date: | Fri, 10 Jun 2011 08:46:42 +0000 |
| Subject: | "The ternary operator" | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969382776@lists.php.net to get a copy of this message | ||
Having started my documentation career by doing some work on the main Operators page,
I'd like to introduce a subject that has long bugged me: the term "the ternary
operator" to
describe ? :
Whilst it's strictly true that, as far as PHP is concerned , ? : is *the* ternary operator,
that's
not really a description of its function, in contrast to most other operators which are usually
referred to by their functionality. It's also a (very slight) potential pitfall should PHP ever
be
moved to introduce another ternary operator (and this *was* proposed recently, using ?? :
or thereabouts to do an isset() test rather than an ==true one!).
I'd like to consider reworking the docs a bit to refer to ? : as the "conditional
operator" (or
perhaps "selection operator " or "choice operator"), and would like to solicit
opinions on
such a move. I realise this is a fairly big departure from past practice, and might even be
regarded in the same light as a BC break, so some reasoned discussion would be welcome. I
also think consideration should be given to moving it out to its own <sect1>, as to me
it's not
really think it's a true comparison operator - but this is secondary to the main topic of
changing how its referred to.
What do you think?
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507 City Campus,
Portland Way, LEEDS, LS1 3HE, United Kingdom
E: m.ford@leedsmet.ac.uk T: +44 113 812 4730
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm