Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21227 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43023 invoked by uid 1010); 15 Dec 2005 10:39:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43008 invoked from network); 15 Dec 2005 10:39:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Dec 2005 10:39:16 -0000 X-Host-Fingerprint: 195.225.34.5 fw01.axit.nl Received: from ([195.225.34.5:24298] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id FF/66-23096-3D741A34 for ; Thu, 15 Dec 2005 05:39:15 -0500 Message-ID: To: internals@lists.php.net References: <43A0F0BB.6080009@chiaraquartet.net> <4858f9d90512150059x71eec489t@mail.gmail.com> Date: Thu, 15 Dec 2005 11:36:23 +0100 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2670 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Posted-By: 195.225.34.5 Subject: Re: [PHP-DEV] why is '01' == '1.'? From: r.korving@xit.nl ("Ron Korving") This may sound like a screwed up idea, and I'm not even sure if I would support it, but just something that went through my mind: A 2nd (flag) parameter for switch could do miracles: switch ($var, SWITCH_STRICT) { } and could be used for more than just strict checks: switch ($var, SWITCH_STRICT | SWITCH_REGEXP) { case '/^[0-9]+$/': echo 'a number'; break; } or perhaps with byte-flags like with fopen(): switch ($var, 'r') { case '/^[0-9]+$/': echo 'a number'; break; } Just an idea, and perhaps gross, but very practical if you ask me. - Ron "Stefan Walk" schreef in bericht news:4858f9d90512150059x71eec489t@mail.gmail.com... See http://bugs.php.net/bug.php?id=23110 It's definitely a gotcha, especially if you use switch(){}, as there is no way to do strict type checking there. Regards, Stefan