Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96725 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64890 invoked from network); 3 Nov 2016 16:12:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Nov 2016 16:12:03 -0000 Authentication-Results: pb1.pair.com header.from=contactme@antonydandrea.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=contactme@antonydandrea.com; spf=permerror; sender-id=softfail Received-SPF: error (pb1.pair.com: domain antonydandrea.com from 213.171.216.27 cause and error) X-PHP-List-Original-Sender: contactme@antonydandrea.com X-Host-Fingerprint: 213.171.216.27 exch-smtp-out.livemail.co.uk Linux 2.6 Received: from [213.171.216.27] ([213.171.216.27:45684] helo=exch-2010-smtp-out-04.livemail.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/3E-34238-1D16B185 for ; Thu, 03 Nov 2016 11:12:03 -0500 Received: by exch-2010-smtp-out-04.livemail.co.uk (Postfix, from userid 500) id 1B87BAE59FB; Thu, 3 Nov 2016 16:11:58 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on exch-2010-smtp-out-04.livemail.co.uk X-Spam-Level: X-Spam-Status: No, score=0.0 required=7.0 tests=AWL,HTML_MESSAGE autolearn=disabled version=3.3.1 Received: from exch4-ht01.email4.local (mail213-171-216-93.livemail.co.uk [213.171.216.93]) by exch-2010-smtp-out-04.livemail.co.uk (Postfix) with ESMTP id 8FF88AE5D07; Thu, 3 Nov 2016 16:11:58 +0000 (GMT) Received: from EXCH4-MBX03.email4.local ([fe80::68b1:44a6:8919:d50e]) by exch4-ht01.email4.local ([fe80::6024:bc8c:17c0:aa2d%17]) with mapi id 14.03.0319.002; Thu, 3 Nov 2016 16:11:58 +0000 To: "bishop@php.net" CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] Proposed RFC Thread-Index: AdI13+OSeD2pbTsoTayeD04p0RFabgAC9XCAAAA2+So= Date: Thu, 3 Nov 2016 16:11:56 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [185.53.227.178] Content-Type: multipart/alternative; boundary="_000_A2B4634FB13FB849A1CCA442A9F793304D0637D1exch4mbx03email_" MIME-Version: 1.0 Subject: RE: [PHP-DEV] Proposed RFC From: contactme@antonydandrea.com (Antony D'Andrea) --_000_A2B4634FB13FB849A1CCA442A9F793304D0637D1exch4mbx03email_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thanks everyone for your responses. It has not taken long to find situations where this idea starts to fall apa= rt. For example, in the case of strpos, I would hope for the return value, = but in other cases I would want the the original input if the output is not= false. That makes this feature pretty unfeasible I think! ________________________________ From: bishop.bettini@gmail.com [bishop.bettini@gmail.com] on behalf of Bish= op Bettini [bishop@php.net] Sent: 03 November 2016 16:02 To: Antony D'Andrea Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Proposed RFC On Thu, Nov 3, 2016 at 11:02 AM, Antony D'Andrea > wrote: I would like to propose a new feature that is as clean as this but is a sli= ghtly different use case. This would require a new operator (up for discuss= ion, but an early idea is "?!") For example: echo (!is_infinite($n1/$n2)?!0); Would output ($n1/$n2) if it is "true" and 0 if false. Welcome! Let me read back what I'm hearing. If the predicate returns truthy, you wan= t to return the argument to the predicate, otherwise the indicated default? How would this be used outside predicates, such as on string functions? Consider: echo strpos('abc', 'b') ?! 0; What would this output, and what would the purpose of such a construct be? --_000_A2B4634FB13FB849A1CCA442A9F793304D0637D1exch4mbx03email_--