note 126306 added to migration70.new-features

From: Date: Tue, 03 Aug 2021 16:55:32 +0000
Subject: note 126306 added to migration70.new-features
Groups: php.notes 
Request: Send a blank email to php-notes+get-216737@lists.php.net to get a copy of this message
peculiar behavior on null coalescing operator in an if statement $x = array(); if ($x['b']??'n/a' === 'whatever') { // this is always true if 'b' does not exist if (($x['b']??'n/a') === 'whatever') { // only true if $x['b'] === 'whatever' you probably want to wrap your null coalescing in parentheses for most cases. * same result with == and === ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 174.27.90.148) ---- Manual Page -- https://php.net/manual/en/migration70.new-features.php Edit -- https://main.php.net/note/edit/126306 Del: integrated -- https://main.php.net/note/delete/126306/integrated Del: useless -- https://main.php.net/note/delete/126306/useless Del: bad code -- https://main.php.net/note/delete/126306/bad+code Del: spam -- https://main.php.net/note/delete/126306/spam Del: non-english -- https://main.php.net/note/delete/126306/non-english Del: in docs -- https://main.php.net/note/delete/126306/in+docs Del: other reasons-- https://main.php.net/note/delete/126306 Reject -- https://main.php.net/note/reject/126306 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216737) next »