Re: Function proposal: varset
| From: | Alain Williams | Date: | Wed, 20 Apr 2011 16:19:11 +0000 |
| Subject: | Re: Function proposal: varset | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51960@lists.php.net to get a copy of this message | ||
On Wed, Apr 20, 2011 at 11:06:47AM -0500, Brian Moon wrote:
> >It might be nice to extend it such that if the 1st argument is a list then
> >the
> >first in the list which is set is returned, eg:
> >
> > $var = var_set(($_GET['var'], $_POST['var']), 'default');
>
> If that is the usage, I would suggest coalesce() to be consistent with
> the same concept in SQL. And you would not need a list as the first
> argument. Just pass multiple arguments and return the first set value.
>
> $var = var_set($_GET['var'], $_POST['var'], 'default');
Even better.
> http://en.wikipedia.org/wiki/Null_%28SQL%29#COALESCE
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>