I usually try to build UTF-8 support into the sites and web applications I build. In PHP land that usually means using the multibyte string extension mbstring. A number of people have noticed, though, that there are some often used PHP string functions with no mbstring equivalent. One of those functions is str_replace(). So for anyone looking for a mb_str_replace() function the one below should serve you nicely. It should work in exactly the same manner as str_replace().
I thought it might be a nice idea to start posting useful little commands and bits of code every now and then–ones I’ve found to be particularly useful. So here’s the first one, recursive find and replace. A masterfully crafted regular expression paired with this command can save you hours of tedious work.