Why not display Russian characters?

Screenshot

I created a .htaccess file in the root of the file and wrote AddDefaultCharset utf-8 into it and still does not help.

<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Массивы</title> </head> <body> <?php header('Content-Type: text/html; charset=utf-8'); ///////длина строки echo "длина строки - 'Hello, world': " . strlen('Hello, world').' символов<br>'; /////////функция, которая считает повторение символов в строке $data = 'g dgdthrdhd ewtewj '; $result = count_chars($data, 0); for($i = 0; $i < count($result); $i++){ if($result[$i] !=0){ echo chr($i). ' встречается в строке ' . $result[$i] . ' раз <br>'; } } ////////////реверс строки echo strrev('компьютер'); ?> 

    1 answer 1

    strrev does not support utf-8, like many other functions in php. in the documentation, the first comment suggests this solution

     function utf8_strrev($str){ preg_match_all('/./us', $str, $ar); return join('',array_reverse($ar[0])); }