Re: New Operator
| From: | Cristiano Duarte | Date: | Tue, 14 Mar 2006 14:24:52 +0000 |
| Subject: | Re: New Operator | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-22408@lists.php.net to get a copy of this message | ||
Jason Garber wrote:
> Hello internals,
>
> Since nobody could seem to agree on a language construct for
> accessing a variable that you don't know exists (ifsetor),
> I would like to propose a simpler approach.
>
> It returns the value of the passed variable, or NULL if the variable
> does not exist.
>
> ifset($some_array['some-key-you-are-not-sure-exists']);
IMHO, this wouldn't solve the problem. The problem is that we need default
values, not NULL. Sometimes you may want NULL sometimes you may not.
>
> This E_STRICT ternary pain-in-the-ass expression is constantly at
> the top of every PHP script I write:
>
> $ConfirmCode = (isset($_GET['ConfirmCode']) ? $_GET['ConfirmCode'] :
> '');
I agree that this is really a PITA, but until we get an operator for this,
we should stuck on the ternary.