Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10984 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29687 invoked by uid 1010); 8 Jul 2004 15:31:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 29630 invoked by uid 1007); 8 Jul 2004 15:31:30 -0000 Message-ID: <20040708153130.29628.qmail@pb1.pair.com> To: internals@lists.php.net Reply-To: jay@php.net Mail-Copies-To: jay@php.net Date: Thu, 08 Jul 2004 11:31:08 -0400 References: <20040708002654.7442.qmail@pb1.pair.com> <1093095066.20040708032739@marcus-boerger.de> <20040708140845.13476.qmail@pb1.pair.com> Lines: 40 User-Agent: KNode/0.7.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Posted-By: 216.94.11.234 Subject: Re: [PHP-DEV] what happened to that new isset() like language construct From: jay@php.net (Jay Smith) Marc Richards wrote: > > Well I'm partial to ?: and there seemed to be some support for it, but > there also seemed to be a non-trivial (though not necessarily difficult) > amount of work to get it to work right. > > ifsetor() is obviously less concise, but also the name at first glance > is a little non-obvious/confusing. I suppose isset() suffers from the > same problem, and people will eventuall get used to it. > > If the technical problems can be overcome, I'm all for ?: otherwise > ifsetor() seemed like the best suggestion so far. I am far less > qualified to come up with an alternative than the more experienced > PHP'ers out there. > > > Marc As far as the name is concerned, I'm kind of partial to coalesce(), as the purpose of the function is really similar to the SQL function of the same name. This is from the Postgres manual, although I think the function itself is from SQL99: "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)') ..." In effect, that's more or less what this function is supposed to as I understand it -- in PHP's case, it returns the first argument from its argument list that is set and has a value, if none is found it returns NULL. Personally, I like coalesce() if only because of my familiarity with the SQL function. I know that many PHP users are familiar with SQL, although how many are familiar with coalesce() is another matter. J