# Negative string offset support

- Thread: https://externals.io/message/13663
- Original archive: https://news-web.php.net/php.internals/13663
- Started by Ford on 2004-11-01T10:45:54+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13663 — Ford — 2004-11-01T10:45:54+00:00

URL: https://externals.io/message/13663#13663

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:
> > […]

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
