This discussion is equivalent to the one that we just had. Read the thread
"[PHP-DEV] Implicit isset/isempty check on short-ternary operator".

Also the "$var = var_set($_GET['var'], $_POST['var'], 'default');" syntax
you propose would be equivalent to (as per previous discussion):

$var = $_GET[?'var'] $: $_POST[?'var'] $: 'default';

(The syntax might also be [?'var'], ['var'?] or different).


On 20 April 2011 18:19, Alain Williams <a...@phcomp.co.uk> wrote:

> 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>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to