Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91551 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57504 invoked from network); 8 Mar 2016 18:55:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Mar 2016 18:55:40 -0000 Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ralphschindler.com from 209.85.218.50 cause and error) X-PHP-List-Original-Sender: ralph@ralphschindler.com X-Host-Fingerprint: 209.85.218.50 mail-oi0-f50.google.com Received: from [209.85.218.50] ([209.85.218.50:33453] helo=mail-oi0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/E7-03587-B202FD65 for ; Tue, 08 Mar 2016 13:55:39 -0500 Received: by mail-oi0-f50.google.com with SMTP id d205so17738622oia.0 for ; Tue, 08 Mar 2016 10:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ralphschindler-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=72OSpsqxqSfJEwCwOm2EdWX8cMkfDXhOXahBr0SFeTU=; b=mcPjXdSm717cw3wYJmVWkv9by0M6Yd+o0O8rhuHqO6bddOf2StreP7vVKeLQ0D2q9p zjNgQ520x14tI/OnfyotjNeOd5K/S00ILXHGyexYuVhGsueHT2tJg+674xIDYIHA/IJ4 TzmQYufPWqs23+GFPv8Rn70wk7aW6EP9A9VeRFgclLLnKhsyQfDpEJOSIEhIFFaxpwWM 03hsGfGd4eWMH6mSpgzgkkjWEifS4KMOD7IN6S5uJ6WHIukI5X2erg6lQvyLm5h4aczC C4Hk5juk9T0+harrUUxjPmV/FxuGusA/B+QhsHqeXl0o01BIM1A/QqNyRQ540mpa+I+w liBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=72OSpsqxqSfJEwCwOm2EdWX8cMkfDXhOXahBr0SFeTU=; b=c7tg/YUkDb9bHOc0omgI67DxMaZb3iUwSRPZx5bTbnufsM+ObwwS7DBd4Qqm9drSov csNdssdoKviY7E54yqgDqoFkomfv6+nNp4E0+KPXVq2mH1Z9gRrNto71Oq4c/sOER/oE LB0JnuT/FP1T4hfI9geHTfMHC6RN7IOdBoAZkINVqIei7Xe+h8cUzRLQlWjkdQl+ZcWi UGaPi90hg++nSZ4u8cJCm77fBzgJwIB6gGSlrSMxK1iijSen3qYbq+taZV5HWE6mIISA VfOkiWHq3CB8b883rzXctO6jdb/XG56RO988m0pNyWsZTBPZKZ5ZgWw7Q7Y0qSeOUtHU VePw== X-Gm-Message-State: AD7BkJLYuDNWpgdfOoxAfzmhT6UJiiAT2qbkBVoFwAmibtlQbhbc5b029MQ1EkBaPKSukg== X-Received: by 10.202.69.134 with SMTP id s128mr16162576oia.97.1457463336618; Tue, 08 Mar 2016 10:55:36 -0800 (PST) Received: from [172.16.1.6] (ip72-211-77-44.no.no.cox.net. [72.211.77.44]) by smtp.googlemail.com with ESMTPSA id cd5sm1753612oec.15.2016.03.08.10.55.35 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Mar 2016 10:55:36 -0800 (PST) To: internals@lists.php.net References: <4DF77339-7112-4F26-A98D-82E6492880C2@gmail.com> Message-ID: <56DF2027.1090206@ralphschindler.com> Date: Tue, 8 Mar 2016 12:55:35 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <4DF77339-7112-4F26-A98D-82E6492880C2@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Equal Null coalescing operator ??= https://github.com/php/php-src/pull/1795 From: ralph@ralphschindler.com (Ralph Schindler) On 3/8/16 11:59 AM, Midori Kocak wrote: > Remember my question? > > $this->request->data['comments']['user_id'] = $this->request->data['comments']['user_id'] ?? ‘value’; > > I want to check if some var is null and if the same var is null set the same var to ‘value’. > > Hence I am repeating the same variable after the equal operator, this does not feels right. > > So I feel that we need another operator like “??=“ similar to +=; > > $this->request->data['comments']['user_id’] ??= ‘value’. So if the var is null it’s set to ‘value’ and else stays the same. > > I implemented it. Please check this here: https://github.com/php/php-src/pull/1795 +1 I like this idea and would like to see it as an RFC. -ralph