Re: ifsetor like expression in php6
| From: | Lars Strojny | Date: | Sat, 26 Jan 2008 22:12:40 +0000 |
| Subject: | Re: ifsetor like expression in php6 | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34949@lists.php.net to get a copy of this message | ||
Hi,
Am Samstag, den 26.01.2008, 22:43 +0100 schrieb Johannes Schlüter:
[...]
> ?: 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".
Thanks for making this clear. That's exactly how I understood it and I
didn't read before about it. That's why I guess it is intuitive :-)
cu, Lars
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc