Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10986 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87327 invoked by uid 1010); 8 Jul 2004 16:40:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 86442 invoked from network); 8 Jul 2004 16:40:39 -0000 Received: from unknown (HELO amber.vis-av.com) (66.92.75.243) by pb1.pair.com with SMTP; 8 Jul 2004 16:40:39 -0000 Received: (qmail 19098 invoked from network); 8 Jul 2004 16:40:38 -0000 Received: from unknown (HELO random.?none?) (192.168.1.9) by amber.internal with SMTP; 8 Jul 2004 16:40:38 -0000 Received: (nullmailer pid 6241 invoked by uid 0); Thu, 08 Jul 2004 16:40:38 -0000 To: Christian Schneider Cc: Jason Garber , internals@lists.php.net, contact_marcos@yahoo.es References: <5.1.0.14.0.20040707203931.02fa6200@mail.ionzoft.com> <40ED64A0.7050305@cschneid.com> Reply-To: Derrell.Lipman@UnwiredUniverse.com Date: Thu, 08 Jul 2004 12:40:37 -0400 In-Reply-To: <40ED64A0.7050305@cschneid.com> (Christian Schneider's message of "Thu, 08 Jul 2004 17:13:36 +0200") Message-ID: <4qoi78qi.fsf@random.internal> Lines: 39 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) XEmacs/21.4 (Common Lisp, i386-debian-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [PHP-DEV] what happened to that new isset() like language From: Derrell.Lipman@UnwiredUniverse.com Christian Schneider writes: > Before it gets forgotten: I still think that > $x = ifsetor(mixed var, mixed var [, ...]); > with expressions in all parts is the way to go. > > Example usage: > $a = ifsetor($_REQUEST['x'], $db->get('x'), 'default_x'); > > And I also think that the name ifsetor has to be reevaluated :-) This is the exact usage and meaning of the SQL function coalesce(). That may be an appropriate name. From the sqlite documentation: coalesce(X,Y,...) Return a copy of the first non-NULL argument. If all arguments are NULL then NULL is returned. There must be at least 2 arguments. And from the postgres documentation: COALESCE(value [, ...]) The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. This is often useful to substitute a default value for null values when data is retrieved for display, for example: SELECT COALESCE(description, short_description, '(none)') ... Like a CASE expression, COALESCE will not evaluate arguments that are not needed to determine the result; that is, arguments to the right of the first non-null argument are not evaluated. The coalesce() function is from the ANSI/ISO SQL:1999 standard, so its use has been around for a while. Derrell