On Wednesday, 26 June 2024 at 06:39, Dusk <[email protected]> wrote:
> On Jun 25, 2024, at 22:18, Mike Schinkel [email protected] wrote:
>
> > This leads me to think strtok()
should not be deprecated given how
> > inefficient string handling in PHP can otherwise be, at least not without a much more efficient
> > object for string parsing.
>
>
> What would be really useful as a replacement for strtok() - among other things - would be a
> function analogous to MySQL's SUBSTRING_INDEX():
>
> https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_substring-index
>
> Where SUBSTRING_INDEX($a, $b, $c) is functionally equivalent to explode($a, $b)[$c], but with
> the added ability to use negative indices to count from the end of the input.
That is a rather interesting function that I did not know existed in MySQL.
I agree this would be useful, and probably should be its own RFC/thread.
Best regards,
Gina P. Banyard