Re: Negative string offsets
| From: | Alain Williams | Date: | Thu, 17 Apr 2014 12:23:40 +0000 |
| Subject: | Re: Negative string offsets | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73715@lists.php.net to get a copy of this message | ||
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>