Reputation: 1
I've got an issue:
I have string $title = "ŁAZIENKA"
and I need to convert it to: <span>Ł</span>AZIENKA
.
I used tried to get the first element of string like this: $first = $title[0]
and $first = substr($title, 0, 1)
. In both cases $first
equals "?".
I also tried some utf8_encode()
and mb_convert_ecncoding()
, but it still doesn't work
Upvotes: 0
Views: 232
Reputation: 3667
For multibyte strings, you need to use the mb_
-functions:
first = mb_substr($title, 0, 1)
It's best to use them all the time - except you can definitely rule out that multibyte character can be part of that string.
Upvotes: 2