Re: Negative string offsets
| From: | Daniel Macedo | Date: | Thu, 17 Apr 2014 12:37:31 +0000 |
| Subject: | Re: Negative string offsets | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73716@lists.php.net to get a copy of this message | ||
Pretty interesting, but I'm sure this is (yet another) stepping stone until
someone suggests the Python syntax for slicing strings and arrays :p
On Thu, Apr 17, 2014 at 1:23 PM, Alain Williams <addw@phcomp.co.uk> wrote:
> On Thu, Apr 17, 2014 at 01:01:44PM +0100, Leigh wrote:
> > Hi Internals,
> >
> > What are peoples thoughts on allowing negative string offsets, that
> return
> > characters from the end of a string.
> >
> > Example:
> >
> > $string = 'foobar';
> > print $string[-1]; // prints 'r';
> > print $string[-2]; // prints 'a';
>
> Good idea.
>
> --
> Alain Williams
> Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT
> Lecturer.
> +44 (0) 787 668 0256 http://www.phcomp.co.uk/
> Parliament Hill Computers Ltd. Registration Information:
> http://www.phcomp.co.uk/contact.php
> #include <std_disclaimer.h>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>