Re: PHP 5.1
| From: | Zeev Suraski | Date: | Tue, 14 Jun 2005 13:54:19 +0000 |
| Subject: | Re: PHP 5.1 | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16669@lists.php.net to get a copy of this message | ||
At 16:54 14/06/2005, Sebastian Mendel wrote:
Ron Korving wrote:One is not supposed to be emitted either, variables passed by reference don't generate notices regardless of whether they exist or not, to allow returning data through them. This implementation of issetor() actually works fine, except it does pollute the symbol tables with empty variables ($a and $b in this examples are created, as nulls). ZeevNo, ifsetor() is not possible in user land, because it generates notices, and a php core function ifsetor() would not generate notices. That's really the way it has to be. i see no notice produced by this ifsetor()function ifsetor(&$var, $default = null) {return isset($var) ? $var : $default;} echo ifsetor($a, 'foo'); echo $a, $b; echo ifsetor($a, 'foo'); echo isset($a) ? 'is set' : 'not set'; expected result: foo Notice: Undefined variable: a in [...] Notice: Undefined variable: b in [...] foo not set actual result: foo Notice: Undefined variable: b in [...] foo not set