Re: Construct Request
| From: | Marcus Boerger | Date: | Thu, 15 Apr 2004 21:24:34 +0000 |
| Subject: | Re: Construct Request | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9233@lists.php.net to get a copy of this message | ||
Hello Derick,
Thursday, April 15, 2004, 10:07:01 PM, you wrote:
> On Thu, 15 Apr 2004, Jason Garber wrote:
>> I see. I was basing the spec on the functionality of isset() which does
>> not (obviously) throw an E_NOTICE when you pass an undefined variable to
>> it. However, do you see any reason that this would not reliably work?
> I wrote this (I underlined the relevant parts for you):
>> >You'll need something more clever, because
>> >an undefined key 'CUST_ID' in $_POST['CUST_ID'] will strill throw a
> ===============================================
>> >warning, even if you pass it to a language construct. Changing that
>> >behavior is not trivial.
Not really hard, we have several modes ofr accessing values. Some of them
allow error free access. Furthermore you can implement it in the following
way:
$var = $val ?: $else;
$var = if (isset($val)) $val else $else;
in contrast to
$var = if ($val) $val else $else;
Notice that the former implementation does not need any change in access
methods. It simply uses a different access for the test or better said it
creates a different test.
Best regards,
Marcus mailto:helly@php.net