Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10985 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43951 invoked by uid 1010); 8 Jul 2004 16:31:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43927 invoked from network); 8 Jul 2004 16:31:24 -0000 Received: from unknown (HELO colo.lerdorf.com) (66.198.51.121) by pb1.pair.com with SMTP; 8 Jul 2004 16:31:24 -0000 Received: from rasmus2.corp.yahoo.com (rasmus2.corp.yahoo.com [207.126.233.18]) by colo.lerdorf.com (8.12.11/8.12.11/Debian-5) with ESMTP id i68GVNxX030868; Thu, 8 Jul 2004 09:31:23 -0700 Date: Thu, 8 Jul 2004 09:31:18 -0700 (PDT) X-X-Sender: rasmus@thinkpad.lerdorf.com To: Marc Richards cc: internals@lists.php.net In-Reply-To: <20040708151952.92187.qmail@pb1.pair.com> Message-ID: References: <5.1.0.14.0.20040707203931.02fa6200@mail.ionzoft.com> <40ED64A0.7050305@cschneid.com> <20040708151952.92187.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on colo Subject: Re: [PHP-DEV] what happened to that new isset() like language From: rasmus@php.net (Rasmus Lerdorf) On Thu, 8 Jul 2004, Marc Richards wrote: > Christian Schneider wrote: > > > 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'); > > > > The other syntax could work for that as well... > > $a = $_REQUEST['x'] ?: $db->get('x') ?: 'default_x'; > > > and with a little white-space it is even more readable: > > $a = $_REQUEST['x'] ?: $db->get('x') ?: 'default_x'; That syntax is way too confusing. Spotting the difference between: $a = $b ?: $c ?: $d; $a = $b ? $c : $d; is non-trivial and the two would do completely different things. This needs to be a function that people can easily look up in the documentation. -Rasmus