Re: Implicit isset in ternary operator

From: Date: Mon, 23 Jul 2012 04:08:01 +0000
Subject: Re: Implicit isset in ternary operator
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> I think that you can compare the situation to the short if syntax ($a > $b
> ? $c : $d) 

Not sure I understand... that *is* the situation under discussion,
no?

$a > $b ? ...

and

$a ? ...

both use the ternary operator.

You do raise (maybe on purpose, not totally clear what you were
getting at) the question of whether a more complex (expr1) in one of
these theoretical ternarys w/implicit isset, however it is
implemented, would apply the isset to _any_ variable in (expr1)? That
is, if $a or $b do not exist, does

$a > $b ?? ...

return an error? What if both do not exist?

I think the conclusion (as reached by other people) is that the
operator needs to apply to each individual variable, not to a
multi-step deal like the ternary where there are more cases to
consider.

-- S.




Thread (31 messages)

« previous php.internals (#61638) next »