Re: Combined assignment operator for short ternary

From: Date: Fri, 24 Aug 2012 21:11:59 +0000
Subject: Re: Combined assignment operator for short ternary
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Fri, Aug 17, 2012 at 11:41 PM, 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';
>

would this trigger a notice if $foo is not defined?
if yes, then it would be different from the current behavior of the ternary
operator.
if no, then I would never use this.
I mean if I have to set the variable before the check, then I would put the
check into the assignment.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


Thread (18 messages)

« previous php.internals (#62460) next »