Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107672 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3370 invoked from network); 24 Oct 2019 23:44:17 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 24 Oct 2019 23:44:17 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 969122D1FBF for ; Thu, 24 Oct 2019 14:30:45 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Thu, 24 Oct 2019 14:30:45 -0700 (PDT) Received: by mail-oi1-x22d.google.com with SMTP id c2so48230oic.13 for ; Thu, 24 Oct 2019 14:30:44 -0700 (PDT) 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 :cc; bh=mnfyu0FkhuVjEpDd+0E1+SGtel67dgG3T6w00jvSHUU=; b=g5kEV8sfoZOxHQ69o5ccpseHYTz6QUF6u+Nz/eI7m8E2P07uKKDvYNivgfI48D4x+M uEOFmU+/1nQnRTy3DHS4E2cUZ8vZ+p63QSgm/z9955+51+ghGZZdGo1ealUUF45HBvRp C1VI9vresRl4kMJLIOIbWtfgFUWzD/vJsSFJlvuqB4Ox7T/IlxdGdWNX8AoX+w9DqJLx /H96Qkot7kD5aXh3+sGwzyaAlXbV32718FIdQma9uK1yBp92mipTnQXIzTwOi1wt6fGT TkQl6ncygTOK6DOEoFhyipAQRWZ9/x+UU470C2S/uASEbiRCEbf9dKIP3HFKV38ZOSq7 Ar1w== 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:cc; bh=mnfyu0FkhuVjEpDd+0E1+SGtel67dgG3T6w00jvSHUU=; b=cT1cUHMAUnF4DC0JjAvi84ypf/1TXSkxOlYqy/krCT9ZvLgIpg95NXdDzqSf1MJnXQ YCdAMrsMekxtDDWFL7NjT8g3fMsAcop7+Etq9pFzxKS2Fn0t0c1MUA7X6U7fYlWrAWpk 9Z/ETrM8jo5+9EHM/xSX3wobDfu34QA7qbQMLHUuu5Q0wg3B96J+5ViZVEugy6yvbYfH H1FPBtHTF6L5a+Ews/aPGDChFAhrhLE4FAoOydCuQHuaFuFB6sR0HkpfNW1dS6C1I/B3 knUFyNnMenm2hhdxR3My6ZCW6BonbPC15tlmN8rpJ5GiX9sL6gKg1Oku+3RV6GZaF/+l P8Fw== X-Gm-Message-State: APjAAAWr32bR39PX0jHS0ROnsDqek76vz269f/GWNdZV9oJOMFxCgZ+h 1jgYDgUNdmC/taJRuxM1cGrOnFs3DR02boW6vB4= X-Google-Smtp-Source: APXvYqxXf6Acra+k4Uxp5tKQXrov2AnxYSE2JSle0NVdPEW9rStVKygrLLFFYngrCXUXTMwspv7BvgzGhX8y9Or49OE= X-Received: by 2002:a54:4f87:: with SMTP id g7mr169523oiy.100.1571952644427; Thu, 24 Oct 2019 14:30:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 25 Oct 2019 04:30:36 +0700 Message-ID: To: Bruce Weirdan Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000f9953d0595aebe66" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] anti-coalescing-operator From: webdevxp.com@gmail.com (Kosit Supanyo) --000000000000f9953d0595aebe66 Content-Type: text/plain; charset="UTF-8" Hi Bruce If I understand correctly. $_SERVER['fname'] !?? $user->setName($_SERVER['fname']); Will return the result of $user->setName($_SERVER['fname']) if $_SERVER['fname'] is set or null if not set. While: isset($_SERVER['fname']) && $user->setName($_SERVER['fname']); Will return boolean. Cheers On Fri, Oct 25, 2019 at 4:24 AM Bruce Weirdan wrote: > Hi Ken > > > $_SERVER['fname'] !?? $user->setName($_SERVER['fname']); > > $_SERVER['lname'] !?? $user->setName($_SERVER['lname']); > > $_SERVER['mname'] !?? $user->setName($_SERVER['mname']); > > $_SERVER['phone'] !?? $user->setName($_SERVER['phone']); > > $_SERVER['email'] !?? $user->setName($_SERVER['email']); > > What you described is already achievable with short-circuit && : > > isset($_SERVER['fname']) && $user->setName($_SERVER['fname']); > > Besides, it's a widely used idiom known from shell scripting. > > -- > Best regards, > Bruce Weirdan mailto: > weirdan@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --000000000000f9953d0595aebe66--