Re: PHP 5.1
| From: | Ron Korving | Date: | Sun, 12 Jun 2005 11:18:01 +0000 |
| Subject: | Re: PHP 5.1 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16614@lists.php.net to get a copy of this message | ||
The problem with your example of firstNotEmpty() would be that if a variable
is not set, I'll get a notice, which I don't want. So it's really no
different from an isset() check. You want to be able to apply it to an
variable that is not yet set.
Ron
""Sara Golemon"" <pollita@php.net> wrote in message
news:38.CE.21296.BFD78A24@pb1.pair.com...
> > > What about ifsetor for 5.1 ?
> >
> > Would anybody be interested in a parameter for ifsetor() that would
treat
> > isset() as !empty() or an alternative function that achieves this? I
know
> > I'd love to see that. I use empty() a lot more than isset().
> >
> In the interrest of KISS, I'd leave the emptiness concept out of the
> picture. Unlike isset-ness, an emptiness coalesce *can* be done in
> userspace:
>
> function firstNotEmpty() {
> $vars = func_get_args();
> foreach($vars as $var)
> if (!empty($var)) return $var;
> return NULL;
> }
>
> There's enough....contention over the undeniably useful and
> not-implementable-in-userspace parts of this thread that it's not worth
> muddling it up with things that are a simple matter to do in userspace.
It
> doesn't matter that notempty() and ifsetor() could easily be implemented
by
> the same opcode (just like isset/empty are).
>
> -Sara