From: Rowan Collins [mailto:rowan.coll...@gmail.com], Sent: Thursday, September 25, 2014 12:31 PM > > Sorry, I was talking about this bit: > >> Currently, switch always uses a "loose" comparison (==), so cannot >> distinguish between "case 3" and "case 3.0". Occasionally, it would be >> nice to switch on a strict comparison (===); but then I thought, why >> stop there? What if you could use switch with any comparison operator? >> >> My idea is to give the switch() statement an optional "use" clause >> (since that's an existing keyword) containing a single comparison operator > > See my earlier e-mail for examples and further details. Maybe I should > have given it its own thread so it was more visible; the idea has been > brewing for a while, I just thought this thread was a convenient place > to mention.
Ah, okay, sorry. What do you think about that: $value = 3; switch (true) { case 3.0 === $value: break; case 3 < $value: break; case 3 > $value: break; } Christian