Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51959 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31566 invoked from network); 20 Apr 2011 16:06:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2011 16:06:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=brian@moonspot.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=brian@moonspot.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain moonspot.net designates 72.5.90.27 as permitted sender) X-PHP-List-Original-Sender: brian@moonspot.net X-Host-Fingerprint: 72.5.90.27 smtp.dealnews.com Linux 2.5 (sometimes 2.4) (4) Received: from [72.5.90.27] ([72.5.90.27:55429] helo=smtp.dealnews.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/18-24878-B940FAD4 for ; Wed, 20 Apr 2011 12:06:52 -0400 Received: (qmail 23289 invoked from network); 20 Apr 2011 16:06:47 -0000 Received: from unknown (HELO mail.dealnews.com) (10.1.10.7) by -H with ESMTPS (DHE-RSA-AES256-SHA encrypted); 20 Apr 2011 16:06:47 -0000 Received: (qmail 13514 invoked from network); 20 Apr 2011 16:06:48 -0000 Received: from h105.248.18.98.static.ip.windstream.net (HELO Brian-Moons-MacBook-Pro.local) (brianm@98.18.248.105) by -H with ESMTPA; 20 Apr 2011 16:06:48 -0000 Message-ID: <4DAF0497.7000407@moonspot.net> Date: Wed, 20 Apr 2011 11:06:47 -0500 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Mark , internals@lists.php.net References: <20110420151205.GI32571@phcomp.co.uk> In-Reply-To: <20110420151205.GI32571@phcomp.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Function proposal: varset From: brian@moonspot.net (Brian Moon) > 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.