On 17 November 2005 21:42, Rasmus Lerdorf wrote: > Andreas Korthaus wrote: > > > Can someone tell me the reason for this decision? > > 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 lines 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 use, 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 convert to [] -- I'll go for substr(..,..,1) instead). Another example: I hate proliferating {} for control structures and use exclusively the if (): ... endif; form -- fine, let me use it; your preference may be otherwise, but that's fine too. In the end, each of us gets the PHP syntax we find easiest 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 other languages. I probably wouldn't guess at all, but look it up, and be very 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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php