Re: Implicit isset/isempty check on short-ternary operator
| From: | Arpad Ray | Date: | Thu, 21 Apr 2011 00:04:35 +0000 |
| Subject: | Re: Implicit isset/isempty check on short-ternary operator | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51969@lists.php.net to get a copy of this message | ||
On Thu, Apr 21, 2011 at 12:56 AM, Arpad Ray <arraypad@gmail.com> wrote:
> I've pined for something like coalesce($_GET['foo'], $defaults['foo'],
> 42) for years, and I think that style is far more in keeping with the
> PHP ethos, and far more readily understandable than this suggested new
> syntax.
>
To elaborate, I'd probably think this code was an unlikely series of
typos, or an encoding error:
$var = $_GET[?'var'] $: $_POST[?'var'] $: 'default';
But as a PHP coder, I'm quite familiar with how coalesce() works.
Regards,
Arpad