Re: PHP 5.1
| From: | Ron Korving | Date: | Tue, 14 Jun 2005 13:57:20 +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-16672@lists.php.net to get a copy of this message | ||
Hmm, you're right.. so the reference "&" already takes care of this...
Well, then I don't see the point of the whole ifsetor() discussions...
people can implement this themselves.
Ron
"Sebastian Mendel" <lists@sebastianmendel.de> wrote in message
news:49.34.20931.46FDEA24@pb1.pair.com...
> Ron Korving wrote:
>
> >> 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
> >
> > No, 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()
>
>
> --
> Sebastian Mendel
>
> www.sebastianmendel.de
> www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet