To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
Nah that patch won't do because it'll effect [] also.
It's more complicated than that. I've tried separating them in the
past and it was annoying (and didn't have time to finish it off).
Well, according to the docs, the [] syntax is deprecated -- if the
[]and {} syntaxes are fully separated, and if functionality is
added to the {} syntax only, wouldn't this be a good time to
emphasize that deprecation and set an actual cutoff for it (such as
PHP 6.0?)?
Incidentally, I'd be about +100 (if my opinion counted for that
much!) for $string{-1}, purely for readability -- any performance
gain would be a bonus.
At 05:51 PM 10/29/2004 -0700, Sara Golemon wrote:
- People might want to take this even further and request {1,3},
{-3,2} and the like. (This was expressed in the past when
talking about this stuff)They might... and the response to that is that it's a more
siginificant modification/glut of the exisiting code than merely
allowing negative offsets. The fact is allowing negative string
offsets via the {} operator involves changing one line, and it's no
major waste of CPU cycles. Fullsubstr()
esque behavior would be
more bloat-intensive of course and I'd be inclined to side against
that.
I'd also be +several for folding substr()
behaviour into the {} string
syntax -- I've often thought that if I ever have time to muck about
with the source, I'd like to make that my first little project.
(Incidentally, re another post, I'd expect $string{$m, $l} to be the
substring clone, and $string{$m:$n} to be "from offset $m to offset $n"
syntax -- and, personally, I'd like to see both. But then, I'm a
programmer with over 20 years experience, so probably not your typical
PHP user at all, and I can quite see the argument about not cluttering
up PHP with potentially obscure syntaxes. So I'll shut up now! ;)
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