Re: RFC: Strict comparisons

From: Date: Fri, 23 Sep 2016 16:40:38 +0000
Subject: Re: RFC: Strict comparisons
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-96112@lists.php.net to get a copy of this message
On 23/09/2016 16:59, Stephen Reay wrote:
I would however love a way to have strict comparisons in a switch statement.
I've been pondering an idea for ages of a generalised syntax for switch to specify an operator to use, so you'd do something like this: switch ( $foo ) use ( === ) {
    case 1:
       something();
    break;
    case '1':
       not_the_same_thing();
    break;
} At some point, I'll get round to attempting a proof of concept and writing up an RFC... Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#96112) next »