Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113244 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91662 invoked from network); 24 Feb 2021 15:40:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Feb 2021 15:40:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E561E1804E3 for ; Wed, 24 Feb 2021 07:29:23 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 24 Feb 2021 07:29:20 -0800 (PST) Received: by mail-oi1-f174.google.com with SMTP id l133so2775334oib.4 for ; Wed, 24 Feb 2021 07:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=PCeFW7RQK1t8Exmsd4VP131awxX/1+wjQt7kwTC1HbQ=; b=ArwPb118DZpGh1x0XIocL0ndT8WhJK8+gEGk8SRPy1+T3aK8Y401V/Zss8FZboNNqF 2bd12EAPhgtzYKxvN7eOa2cny93saPMccvoCU4WA9uZ5AaWLHaDFXte7UXabWpxRT63x dpoqMuc2YcvFXEA+/CxnQSby5jWV8A0vKr1t3daZqvzWe16TIe9BLfGYM6QRi57QeJQ3 M2bx3Pgv+zLYRNIolXj6k/r+UZI1HVv6hIz7bujpAq/oJPWzFveWESlSOU1Tzj5ReNcM 5PZWRDlvPe1P0XJkO0FcuKml4ncMU9EMAhyAWnFu3pY6RBJ5xqc6BY2AOxkpIiIzzST6 vHiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=PCeFW7RQK1t8Exmsd4VP131awxX/1+wjQt7kwTC1HbQ=; b=i2WXWIzOPN0Bw3caWwLFBo13ilj+0KJLt1SIpMYUGJyUSoFpjszUljseAu+4uNXAuL rc5H3W3EMNoAw/EAfZrwZLiEzUTmw+oQq4n6FnVNtZCUHV/sWHbMkddGJBW7AhAfyWza 3rnSpYsHZUDc71mjvQ28PigUzIJG97mzhkcfA/fPEYGDiNcpKe07LFPOTpX0+fEhwpbk Z7zkQDn+fRNniskNUjAbaNqjdoIRtIN4aZgFx7qiRWUhPQf9TJK+SudkEcf+/1ZASqXI zACnkUwk880W8dDlHFPJP9AqV2RZFBcD68eTNmPIvXv8GQbBqN0OHZ+djkuhwEoQVN6K cpPQ== X-Gm-Message-State: AOAM5304Vc83VQHVYsjYxXN4vHjsfEOuOjz1Ze2OV4jy0FuubJgHqA8/ 9OfPY2nNiaHoyX0IOsTz6MzR8+aBgMMMtOLGnpIYcSefxm9tVA== X-Google-Smtp-Source: ABdhPJz/QSoqJ48RGsrZSFtbbX+LG1KhgkE6//8Jk+7sRPSfrGy3RR4hgH6rmHQuycFRjuPXp6IAbCiIIwdIevps31w= X-Received: by 2002:aca:5f85:: with SMTP id t127mr2916771oib.76.1614180559464; Wed, 24 Feb 2021 07:29:19 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 24 Feb 2021 09:29:08 -0600 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000d9ac3a05bc16b23f" Subject: Re: [PHP-DEV] Inline conditional that returns null if falsy From: tendoaki@gmail.com (Michael Morris) --000000000000d9ac3a05bc16b23f Content-Type: text/plain; charset="UTF-8" Javascript has this now though support isn't widespread. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining The most similar way to do it in PHP would be ?-> On Fri, Feb 12, 2021 at 1:46 PM Ben Ramsey wrote: > > The => is just a suggestion, other options using existing keywords is: > > return expr() then output(); > > return expr(): output(); > > > > I do not know if other languages support something like that. > > > I think it might be a good idea to check other languages to see if they > support something like this. We could use their examples as points of > reference for discussing whether to include this functionality in PHP. > > Cheers, > Ben > > > --000000000000d9ac3a05bc16b23f--