PHP 8.6.0 Beta 1 is available for testing

Voting

: five plus one?
(Example: nine)

The Note You're Voting On

btherl at yahoo dot com dot au
20 years ago
If you use this function on a unicode string without telling PHP that it is unicode, then you will corrupt your string.  In particular, the uppercase 'A' with tilde, common in 2-byte UTF-8 characters, is converted to lowercase 'a' with tilde.

This can be handled correctly by:
$str = mb_strtolower($str, mb_detect_encoding($str));

Or if you know your data is UTF-8, just use the string "UTF-8" as the second argument.

You should check also that mb_detect_encoding() is checking the encodings you want it to check, and is detecting the correct encodings.

<< Back to user notes page

To Top