Re: Function proposal: varset

From: Date: Wed, 20 Apr 2011 16:06:47 +0000
Subject: Re: Function proposal: varset
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-51959@lists.php.net to get a copy of this message
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'); http://en.wikipedia.org/wiki/Null_%28SQL%29#COALESCE Brian.

« previous php.internals (#51959) next »