Php get first letter of string utf-8
As previously mentioned in other questions, with PHP, when attempting to get a substring, it doesn't understand multibyte characters (as you get with UTF8 for example). Show What the other answers don't mention is that you should hint the encoding you would like to use for the mb_substr So, for example, I use this: This is a short guide on how to get the first character of a string in PHP. As an added bonus, I will also show you how to get the first two characters of a string. A simple code snippet:
|