I'm trying to get a letter out of a word.
$slovo="Привет"; echo $slovo[2]; Instead of a letter, a question mark is displayed in a diamond. Encoding costs utf-8 without BOM.
I'm trying to get a letter out of a word.
$slovo="Привет"; echo $slovo[2]; Instead of a letter, a question mark is displayed in a diamond. Encoding costs utf-8 without BOM.
Your Cyrillic version does not work.
Here is a working version.
header('Content-Type: text/html; charset=utf-8'); echo substr('Слово', 0, 2); // результат "С" PS The substr() function perceives a Cyrillic letter as 2 characters, therefore, in the example it is 0, 2 , that is, starting from the zero character, print 2 characters (ie, 1 letter).
In .htaccess list:
AddDefaultCharset UTF-8 Source: https://ru.stackoverflow.com/questions/494349/
All Articles