Re: ifsetor like expression in php6
| From: | Johannes Schlüter | Date: | Sat, 26 Jan 2008 21:43:34 +0000 |
| Subject: | Re: ifsetor like expression in php6 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34947@lists.php.net to get a copy of this message | ||
Hi,
On Sat, 2008-01-26 at 16:23 -0500, Robert Cummings wrote:
> And I thought the whole point was for it to not generate a notice. Isn't
> that why the name ifsetor was chosen? Since it's supposed to work like
> isset() by not generating notices?
This thing is not called "ifsetor". From the commit message:
?: operator
[DOC] "expr1 ?: expr1" is a shortcut for: "expr1
? expr1 : expr2" as exists in gcc and discussed some time back. Note
that this is not an implementation ifsetor($var, default). While
ifsetor would not generate any message for non existing variables or
array indices the ternary shortcut does. Also the ternary shortcut does
a boolean evaluation rather then checking for isset(). That way ther
ternary shortcut can work on any expression while ifsetor can only work
on variables. Also to be silent one has do do: "@$expr1 ?: $expr2".
I didn't check the docs, if it is documented as "ifsetor" there that's
wrong.
For reasons why there is no "ifsetor" but this operator please check the
archives.
johannes