On Jun 25, 2024, at 22:18, Mike Schinkel <m...@newclarity.net> 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.