Re: Combined assignment operator for short ternary

From: Date: Sun, 19 Aug 2012 14:58:11 +0000
Subject: Re: Combined assignment operator for short ternary
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Am 19.08.2012 00:20, schrieb Andrew Faulds:
On 18/08/12 03:36, Tjerk Meesters wrote:
Sent from my iPhone On 18 Aug, 2012, at 5:41 AM, Sebastian Krebs <[email protected]> wrote:
Hi, Don't know, how complicated this is (and also someone (not me) must implement it, because I can't :X), but to be in sync with the operators the short ternary operator should be usable in conjunction with the assignment like the other binary operators. Don't know, if anybody understands me :D So here is an example // instead of $foo = $foo ?: 'default'; // Just $foo ?:= 'default';
Why not just: $foo ?= 'default';
Just noting, I made a ML email earlier about this, except it would be shorthand for isset($lval) ? $lval : $default. And this has been brought up before several times.
The "except" is important: I don't want to change the behaviour in any way.
I have many of this "default assigments" and yes: This is just syntactic sugar. Regards, Sebastian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


Thread (18 messages)

« previous php.internals (#62259) next »