php - Why did this str_ireplace() work on a non ASCII string? -


Note: I think I know that maybe wrong, so please please let me know Correct :)


I used the str_ireplace ('Ð ?? оР»Ð³Ð¾Ð³Ñ ?? Ð ° Ð' ',' ', $ a) Recommended to .

I did not expect to do this work, but did it.

I always thought that PHP has considered a byte as a character, so you should use mb_ * to get accurate results when using characters outside the ASCII range Function for

I thought the Russian letter would take & gt; 1 byte each.

I thought str_replace () will work because the bytes can be matched even if they are multibyte or not, as long as they are in order.

I thought str_ireplace () would not work not because PHP does not know how to map non ASCII characters to their alternative case equivalents. But, it did done work.


Where and how am I wrong? Give me as much detail as you can :)

This works by making text less case by passing it locale For libc functions which are dependent on settings; Appropriate settings mean that the text will lessen the case properly if the correct charset is used for byte.

Comments