Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20143 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57961 invoked by uid 1010); 18 Nov 2005 13:03:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57945 invoked from network); 18 Nov 2005 13:03:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2005 13:03:49 -0000 X-Host-Fingerprint: 160.9.128.16 dns1.lmu.ac.uk Received: from ([160.9.128.16:21677] helo=mrelay-a.lmu.ac.uk) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 17/DE-07637-431DD734 for ; Fri, 18 Nov 2005 08:03:48 -0500 Received: from localhost.lmu.ac.uk ([127.0.0.1] helo=localhost) by mrelay-a.lmu.ac.uk with esmtp (Exim 4.43) id 1Ed5tQ-0005Nq-4k for internals@lists.php.net; Fri, 18 Nov 2005 13:03:04 +0000 Received: from mrelay-a.lmu.ac.uk ([127.0.0.1]) by localhost (mrelay-a [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20318-01 for ; Fri, 18 Nov 2005 13:03:01 +0000 (GMT) Received: from leedsmet-exch1.leedsmet.ac.uk ([160.9.35.117]) by mrelay-a.lmu.ac.uk with esmtp (Exim 4.43) id 1Ed5oS-0005LK-S6 for internals@lists.php.net; Fri, 18 Nov 2005 12:57:56 +0000 x-mimeole: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Fri, 18 Nov 2005 12:58:26 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] dropping curly braces Thread-Index: AcXrwFoG7yMTmnJfRvCeON/O4IaG0gAfK+ZQ To: X-Virus-Scanned: by McAfee at Leeds Metropolitan University Subject: RE: [PHP-DEV] dropping curly braces From: M.Ford@leedsmet.ac.uk ("Ford, Mike") On 17 November 2005 21:42, Rasmus Lerdorf wrote: > Andreas Korthaus wrote: >=20 > > Can someone tell me the reason for this decision? >=20 > Very few people converted to using {} so the argument about > reading old > code doesn't really hold. If you go and grep through all the public > code out there, pretty much none of it uses {} for character offsets. > And internally there is absolutely no difference between {} and []. So all of those who belived the "[] for string access is deprecated" line (= or simply prefer the visual differentiation) and have 10s of thousands of l= ines of code with liberal use of $string{} are going to have to spend ages = fixing that up? > Having two syntaxes for the same thing makes no sense, I don't buy this -- having two ways of doing certain things is one feature = that makes PHP so great -- it increases the user base who find it easy to u= se, as they can pick the method that makes most sense to them. I love the = {} syntax, so let me use it. You don't -- fine, don't use it. (I won't co= nvert to [] -- I'll go for substr(..,..,1) instead). Another example: I ha= te proliferating {} for control structures and use exclusively the if (): .= .. endif; form -- fine, let me use it; your preference may be otherwise, bu= t that's fine too. In the end, each of us gets the PHP syntax we find easi= est to use, without denying the other his preference. What's so wrong with= that? > As far a code readability and obviousness goes, I doubt anybody would > guess their way to the $str{5} syntax. If you were new to > PHP and you > were going to try to guess how you would get a character offset in a > string, what would your first guess be? Well, it wouldn't be [] because I'd guess that's for array access as in oth= er languages. I probably wouldn't guess at all, but look it up, and be ver= y happy to find it was {}. I remember being very, very surprised to find [= ] doing double duty, and glad that {} existed as an alternative. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211=20 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm