Re: Re[2]: [PHP-DEV] PHP 5.1
| From: | Ron Korving | Date: | Tue, 14 Jun 2005 14:34:01 +0000 |
| Subject: | Re: Re[2]: [PHP-DEV] PHP 5.1 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16679@lists.php.net to get a copy of this message | ||
There is one case though, which can still not be implemented (probably?) by
users, and that's a coalesce function, since that would require fetching
values by using func_get_args(), which doesn't return references.
So the only way I could imagine implementing such coalesce() function would
be like this:
function coalesce(&$a=null, &$b=null, &$c=null, &$d=null, &$e=null)
{
if (isset($a)) return $a;
if (isset($b)) return $b;
if (isset($c)) return $c;
if (isset($d)) return $d;
return $e;
}
Which I think is pretty hideous. But I can absolutely live with a lack of
coalesce() since that function wouldn't be as extensively used as ifsetor().
As far as I'm concerned on ifsetor() though: -18927.
But then again, who am I to make such a statement? :)
Ron
"Zeev Suraski" <zeev@zend.com> wrote in message
news:5.1.0.14.2.20050614171838.051169a0@localhost...
....
> I fully agree with everyone else that wondered why we're discussing
> this. People can implement this on their own, the way they want it, with
> an assignment or without it, using empty() or isset(), etc.
>
> Zeev