Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113276 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67138 invoked from network); 25 Feb 2021 23:45:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2021 23:45:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 25B0A1804DD for ; Thu, 25 Feb 2021 15:34:43 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 ; Thu, 25 Feb 2021 15:34:42 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 73C7C5C00D1 for ; Thu, 25 Feb 2021 18:34:41 -0500 (EST) Received: from imap8 ([10.202.2.58]) by compute4.internal (MEProxy); Thu, 25 Feb 2021 18:34:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=bc6MKL wCFDS8rWsc7+TT8+i4FEDtDgK7FkzYfneIX3o=; b=i2XYFPJ7cq0L7B8MRS1W9M nIlbgI0PMrtscnYNGp4Dnpo6Qsff1mH2UTcghqbeuTDqB1BtfPvEG1+1FvqIPdDg 6pUo/0IMxgdjeJhsCNCNYfe3nZgxN3vCW/eCXnctS38AH6kgT+g1RFVaD5csee6x eP8vg2JLpuHcj/YcdqWQxTNaxYp97+Am9UyUA4kumHzAF2ol0n5xA1Ok4IBBdZ7s 1yvblYlDKgyWvfXFWkcxD1RCXCdeX6DSvkunoO7NGWD+CX7CCnTfuihuxCekjwNB JJg+j5IwJLjBZhWNYM0p9IgyjaRLRcaVyc3C/7VPRDFNhHyGIrnf78KHSR31TNjg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrledtgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnheptdehjedujeefkeegkeehleehgfeutdefkeevtdehudet fefgkeegfeeiteefhfehnecuffhomhgrihhnpehshihmfhhonhihrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgr rhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 157A33A0134; Thu, 25 Feb 2021 18:34:41 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-141-gf094924a34-fm-20210210.001-gf094924a Mime-Version: 1.0 Message-ID: <46318dc1-7a3e-41bd-8dae-39a5a97b3638@www.fastmail.com> In-Reply-To: References: <2664e2ef-b965-407c-90fc-77480846a3ad@www.fastmail.com> <84020328-b623-bca1-0c9c-0f7195e08d23@gmail.com> <8CD7D960-51FA-45FE-B88F-2A18BA768DA4@newclarity.net> Date: Thu, 25 Feb 2021 17:34:20 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Inline conditional that returns null if falsy From: larry@garfieldtech.com ("Larry Garfield") On Thu, Feb 25, 2021, at 2:55 AM, Rowan Tommins wrote: > On 24/02/2021 04:26, Mike Schinkel wrote: > > Repeating code similar to that from the message sent by David Rodrigues you can see that eliminating the ": null" is less noisy: > > > >
...
> >
...
> > > That's an interesting use case. Of course, the logical default there is > actually '' (empty string) rather than null, since "echo null;" doesn't > actually make much sense, but null works under current type juggling rules. > > Then again, perhaps this is a good example of why PHP *isn't* the best > choice any more if you want a templating language. Twig, for instance, > has exactly this facility > [https://twig.symfony.com/doc/3.x/templates.html#other-operators]: Given the security implications of plain PHP templating (you're on your own for absolutely all filtering and escaping, good luck), I'd say this isn't even a controversial statement. PHP may have begun life as a templating language for the 90s, but in the 2020s it's a fairly mediocre option at best compared to what else is readily available. --Larry Garfield