php outputs a square instead of the 1st character?

I output the 1st character of the string, I get this character �

$user->profile->lstname[0]."."

At the same time, if the entire line is output, it will be displayed normally.

Yes, you can still solve it this way:

Text::limit_chars($user->profile->firstname,1,".")
Author: Smash, 2013-01-23

1 answers

In UTF-8, it's not that simple with characters.

UTF8::substr($user->profile->lstname, 0, 1).".";
 2
Author: xEdelweiss, 2013-01-23 10:56:08