Re: suggestion about ternary operator
| From: | Alban | Date: | Sun, 22 Nov 2009 04:23:51 +0000 |
| Subject: | Re: suggestion about ternary operator | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46155@lists.php.net to get a copy of this message | ||
Le Sat, 21 Nov 2009 19:52:30 -0800, Rasmus Lerdorf a écrit :
>
> Or better yet, have your filter function return false if the variable
> doesn't exist and use the ternary to set the default. You can do it all
> in a single step then.
>
> $var = filter_func($_GET,'foo')?:42;
>
> Simple and clean.
>
> -Rasmus
Yes, as you say, simple and clean !
Have I miss something like that in php ?
--
Alban Leroux