Re: [PHP-DEV] Proposal for a new basic function: str_contains

This is only part of a thread. view whole thread
March 2, 2020 19:09 (Andrea Faulds)

Philipp Tanlak wrote:
> I like to elaborate on Nikitas response: I don't think a mb_str_contains is > necessary, because the proposed function does not behave differently, if > the input strings are multibyte strings.
This is not true for all character encodings. For UTF-8 it is correct, but consider for example the Japanese encoding Shift_JIS, where the second byte of a multi-byte character can be a valid first byte of a single-byte character. str_contains() would have incorrect behaviour for this case. Regards, Andrea Faulds