Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51962 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43981 invoked from network); 20 Apr 2011 17:14:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2011 17:14:52 -0000 Authentication-Results: pb1.pair.com header.from=landeholm@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=landeholm@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: landeholm@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:45616] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/6A-24878-B841FAD4 for ; Wed, 20 Apr 2011 13:14:51 -0400 Received: by iwn3 with SMTP id 3so956832iwn.29 for ; Wed, 20 Apr 2011 10:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=SOOQxZ8ebOzPH4ZAokZRS7l1DSv00ekmEGT04y06NAE=; b=dTTr2IteJIh1jPAog0RIxFTOYq07mT1YzPUes5hdps33tk7fxrnAzXLYjra8Ydazbp 8sRURA+t/0BslnLaNln9QyhtGDLnOj8B09x/1MGRrLLxN1IiVjD/Dkc3a2MMceos4i3b C8lC+fnrqzOhNoZ81cNd0sPdNQEvDa490No/Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=x+6sG1p166iNeydLDfETqBhqKwhbf8QrTqnpFVXV27JvrH4YTgUkDWB5J9wx3sPFMj 0eq4QxhGr2YtHnXs19M6FXlRbPuEnEmpIGeCvNqdYlW1tHBe4ay97JmvwL9FJXEyEqfr GwULGAqwkY8+Ap1bGA7T4+HUWF09jBit/pi9g= MIME-Version: 1.0 Received: by 10.231.212.216 with SMTP id gt24mr3782308ibb.145.1303319688667; Wed, 20 Apr 2011 10:14:48 -0700 (PDT) Received: by 10.231.37.140 with HTTP; Wed, 20 Apr 2011 10:14:48 -0700 (PDT) In-Reply-To: <20110420161911.GK32571@phcomp.co.uk> References: <20110420151205.GI32571@phcomp.co.uk> <4DAF0497.7000407@moonspot.net> <20110420161911.GK32571@phcomp.co.uk> Date: Wed, 20 Apr 2011 19:14:48 +0200 Message-ID: To: Brian Moon , Mark , internals@lists.php.net Content-Type: multipart/alternative; boundary=0016363108cb12622704a15cc322 Subject: Re: [PHP-DEV] Function proposal: varset From: landeholm@gmail.com (Hannes Landeholm) --0016363108cb12622704a15cc322 Content-Type: text/plain; charset=ISO-8859-1 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 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --0016363108cb12622704a15cc322--