Re: Strict switch statements

From: Date: Thu, 14 Jun 2018 16:10:14 +0000
Subject: Re: Strict switch statements
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-102263@lists.php.net to get a copy of this message
On Thu, Jun 14, 2018 at 11:57 AM, Thomas Bley <mails@thomasbley.de> wrote: > for simplicity I would use an extra parameter to have a strict comparison (similar to the extra > parameter in in_array()): > > switch ($a, true) { // strict comparison > switch ($a) { // loose comparison > I instinctively recoil from boolean arguments as they tend to be opaque at a glance, but perhaps: switch ($a, ===) {...} Would both be more apparent as to its meaning and leave the door open for other uses. Though at that point, tbqh, I think `switch ($a) use (===) {...}` gives better visual isolation. -Sara

« previous php.internals (#102263) next »