Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51960 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33878 invoked from network); 20 Apr 2011 16:19:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2011 16:19:21 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 80.68.91.63 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 80.68.91.63 bytemark.phcomp.co.uk Received: from [80.68.91.63] ([80.68.91.63:60887] helo=bytemark.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/88-24878-8870FAD4 for ; Wed, 20 Apr 2011 12:19:21 -0400 Received: from freshmint.phcomp.co.uk ([78.32.209.33] helo=mint.phcomp.co.uk) by bytemark.phcomp.co.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) (envelope-from ) id 1QCa7T-00018s-OE; Wed, 20 Apr 2011 17:19:11 +0100 Received: from addw by mint.phcomp.co.uk with local (Exim 4.63) (envelope-from ) id 1QCa7T-0003Jh-8J; Wed, 20 Apr 2011 17:19:11 +0100 Date: Wed, 20 Apr 2011 17:19:11 +0100 To: Brian Moon Cc: Mark , internals@lists.php.net Message-ID: <20110420161911.GK32571@phcomp.co.uk> Mail-Followup-To: Brian Moon , Mark , internals@lists.php.net References: <20110420151205.GI32571@phcomp.co.uk> <4DAF0497.7000407@moonspot.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DAF0497.7000407@moonspot.net> User-Agent: Mutt/1.4.2.2i Organization: Parliament Hill Computers Ltd Subject: Re: [PHP-DEV] Function proposal: varset From: addw@phcomp.co.uk (Alain Williams) 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