Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100504 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23973 invoked from network); 10 Sep 2017 16:28:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2017 16:28:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.216 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.216 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.216] ([81.169.146.216:34797] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/2F-10715-01865B95 for ; Sun, 10 Sep 2017 12:28:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1505060878; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=HJpdTsuMFIQEzgK/S/lgzK2iAxciTMwucAW14ALjW2U=; b=RPEtXHW6Jba32vKV9LQpJ8AoU0bo42p0KYxe1bzduO651H22Ih0+Xbt7wJz2bgem20 EJYZcap3u++ElBeJXBILJH8g4tKVmPpBsP57DqjYdfIF9Rick3rbOpmO9HXv85t4NQlp Voi6HbCnWqkpoXTVMy6CCzh8C+OJKrflq0bBo= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuYROBqD/saU= X-RZG-CLASS-ID: mo00 Received: by mail-yw0-f171.google.com with SMTP id s62so17298214ywg.0 for ; Sun, 10 Sep 2017 09:27:57 -0700 (PDT) X-Gm-Message-State: AHPjjUjfrxKCTGsSA95G2h7qovz/X1fOD63CJsVS9u5PyAslQwdOSrX1 b3AjKVXBQuRbunETYSxUrV3CXh0fzw== X-Google-Smtp-Source: AOwi7QDUm/aZAwB26WxSorfToPaZucv8XG2mHGB28i6Si6HBYw9PgWoHIlMu3DWuCFWNLW7CDfZ1ZKR+8rJY9WyUz/Y= X-Received: by 10.37.162.143 with SMTP id c15mr7528212ybi.166.1505060877230; Sun, 10 Sep 2017 09:27:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.224.146 with HTTP; Sun, 10 Sep 2017 09:27:56 -0700 (PDT) In-Reply-To: References: Date: Sun, 10 Sep 2017 18:27:56 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Theodore Brown Cc: "ilija.tovilo@me.com" , PHP internals Content-Type: multipart/alternative; boundary="089e0828e424f3ec230558d84aa3" Subject: Re: [PHP-DEV] [RFC] Match expression From: me@kelunik.com (Niklas Keller) --089e0828e424f3ec230558d84aa3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2017-09-10 18:05 GMT+02:00 Theodore Brown : > On Saturday, September 9, 2017 6:21 AM, ilija.tovilo@me.com wrote: > > > I find myself writing switch statements in PHP quite rarely. This has a > few reasons: > > 1. It doesn=E2=80=99t have a "strict_types=E2=80=9D version > > ... > > I assume that some people will not be so happy about having to > switch-like constructs. IMO the implicit type conversion is the biggest > issue here. Maybe we could offer a solution for this one at least. > > I also rarely use switch, primarily because of the lack of strict > comparison. > Personally I would prefer having an option for strict comparison when > using switch, similar to how `in_array` has an optional `$strict` paramet= er. > > Would it be possible to add an optional `$strict` parameter to switch? E.= g. > > ``` > switch ($i, true) { > case 1: > echo 'i is 1'; > break; > case: 1.0: > echo 'i is 1.0'; > break; > case '1': > echo 'i is "1"'; > break; > case true: > echo 'i is true'; > break; > } I'd very much prefer a "strict switch ($i) { ... }" over a second parameter= . Regards, Niklas --089e0828e424f3ec230558d84aa3--