Re: Function proposal: varset
| From: | Alain Williams | Date: | Wed, 20 Apr 2011 15:32:19 +0000 |
| Subject: | Re: Function proposal: varset | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51957@lists.php.net to get a copy of this message | ||
On Wed, Apr 20, 2011 at 05:19:36PM +0200, Mark wrote:
> > If is is a language element (like isset()) then you can avoid this problem.
> >
>
> Could you explain that a bit more?
It looks like a function but is not:
http://uk3.php.net/manual/en/function.isset.php
> > 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');
> >
> >
> I might be missing the point here, but the way i understand it that can give
> unexpected results.. since it returns the first element from an array in
> your suggestion but that's not what you want to do.
I mean that it checks $_GET['var'], then $_POST['var'] & returns the first
of the two that is set
or 'default'.
--
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>