Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:254 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55494 invoked from network); 25 Mar 2003 11:21:44 -0000 Received: from unknown (HELO mrelay-b.lmu.ac.uk) (160.9.128.17) by pb1.pair.com with SMTP; 25 Mar 2003 11:21:44 -0000 Received: from lis-exchange2.lmu.ac.uk ([160.9.35.2]) by mrelay-b.lmu.ac.uk with esmtp (Exim 4.10) id 18xmUl-0000c0-00; Tue, 25 Mar 2003 11:21:31 +0000 Received: by LIS-EXCHANGE2 with Internet Mail Service (5.5.2653.19) id ; Tue, 25 Mar 2003 11:13:49 -0000 Message-ID: <7E070107F405BA4790C43526CC4985A10132ADC9@lis-exchange3.lmu.ac.uk> To: "'zeev@zend.com'" , internals@lists.php.net Date: Tue, 25 Mar 2003 11:27:14 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Subject: RE: [PHP-DEV] Make switch/case to type sensitive comparison in PH P 5? From: M.Ford@lmu.ac.uk ("Ford, Mike [LSS]") > -----Original Message----- > From: Zeev Suraski [mailto:zeev@zend.com] > Sent: 24 March 2003 17:58 > To: Joey Smith > > At 05:07 24/03/2003, Joey Smith wrote: > >I was reminded tonight of the following 'feature' of switch: > > > >$a = 0; > >switch($a) { > > case 'somestring': echo 'Bug?'; break; > > case 0: echo 'Not a bug'; break; > >} > > > >This will echo 'Bug?' with PHP 4. It seems more logical to > have switch > >comparing with T_IS_IDENTICAL than with T_IS_EQUAL. Is this > something that > >might be changed as we move to PHP 5.0?> > It's not a 'feature', it's a feature. It's not likely to > change, dynamic > type conversion is one of the foundations of PHP. Well, yes, but we have == and === for other situations, so some sort of analogue for use in switches would be nice (I've been bitten by this one more than once myself!). I'd love to see, say, case_identical for requesting an === comparison, with case continuing as before to do an == comparison. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211