I need to get only 30 characters from the paragraph submitted by user. In case the 30th character is an emoji, the output shows question marks. How can I avoid breaking the emojis?
echo substr("Hello world Hello world Hell
I need to get only 30 characters from the paragraph submitted by user. In case the 30th character is an emoji, the output shows question marks. How can I avoid breaking the emojis?
echo substr("Hello world Hello world Hell
I think the simplest solution would be to use mb_substr
Performs a multi-byte safe substr() operation based on number of characters.
php > $myvariable = array();
php > $myvariable['hello'] = mb_substr("Hello world Hello world Hell