Re: Negative string offsets
| From: | Daniel Macedo | Date: | Thu, 17 Apr 2014 16:48:54 +0000 |
| Subject: | Re: Negative string offsets | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73728@lists.php.net to get a copy of this message | ||
I warned this would lead to the Python syntax...
I'm not saying it's a bad thing, and I think it actually has it's uses!
And I won't defend the "confusion" between arrays and strings because the
intention should be to treat developers as smart to handle the validation
of variables prior to using type-specific syntax.
But those examples now make me want to simplify the substr usage with an
imitation of the Python syntax, I can see the possibilities! (=
On Thu, Apr 17, 2014 at 5:41 PM, Andreas Heigl <andreas@heigl.org> wrote:
> On 17.04.14 18:20, Crypto Compress wrote:
> > "foobarbazbuz"[4:7] => "barbazb"
> > "foobarbazbuz"[4-7] => "barb"
> > "foobarbazbuz"[4,7] => ["b", "b"]
> > ...
> >
> "foobarbazbuz"[4,7,8,12] => ["b", "b", "a",
> "z"] ?
> "foobarbazbuz"[4,7-8,3:2] => ["b", "ba", "ob"] ???
> "foobarbazbuz"[4:3,4] => ["bar", "b"] or ["bar",
> "barb"] ?????
> "foobärbuz"[5] => [\xC3] or ["ä"] ????
>
> Regards
>
> Andreas
> --
> ,,,
> (o o)
> +---------------------------------------------------------ooO-(_)-Ooo-+
> | Andreas Heigl |
> | mailto:andreas@heigl.org N
> 50°22'59.5" E 08°23'58" |
> | http://andreas.heigl.org
> http://hei.gl/wiFKy7 |
> +---------------------------------------------------------------------+
> | http://hei.gl/root-ca
> |
> +---------------------------------------------------------------------+
>
>