Re: what happened to that new isset() like language
| From: | Jasper Bryant-Greene | Date: | Sun, 30 Oct 2005 19:20:22 +0000 |
| Subject: | Re: what happened to that new isset() like language | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19850@lists.php.net to get a copy of this message | ||
On Sun, 2005-10-30 at 09:52 +0100, Ron Korving wrote:
> I'm a big fan of coalesce($param1, $param2, ..., $paramN) (or firstset()).
> The syntax allows for more than what ifsetor($var, $value) would do.
> Ifsetor() could be done in userspace, but I don't see how coalesce() could,
> because of the variable number of parameters.
It's not so much the variable number of parameters as the fact that it
has to receive a variable that may not be set. Using a user-space
function will cause an E_NOTICE to be thrown every time the function is
used, because it's receiving an unset variable. It needs to be a
language construct.
FWIW, I like the $a ?? $b and $a ??= $b idea.
--
Jasper Bryant-Greene
General Manager
Album Limited
e: jasper@album.co.nz
w: http://www.album.co.nz/
b: http://jbg.name/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand