Why can not I convert the variable to lower case

list($name, $firstname) = explode(" ", $_POST["name_firstname"]); $a = strtolower($name); 

    4 answers 4

    The string encoding does not match the current PHP system encoding.
    You can change the encoding of the string or PHP, you can use mb_strtolower indicating the specific encoding.

    • and how to change PHP coding. In the apache configuration and file encoding, I have utf-8 - Zow

    Try this option:

     list($name, $firstname) = explode(" ", $_POST["name_firstname"]); echo mb_strtolower($name, 'UTF-8'); 

      The strtolower() function converts only the Latin alphabet. Cyrillic function ignores. Perhaps this is the case.

      Link to official documentation.

      • Not certainly in that way. The function works great with any single-byte encodings, the same windows-1251. utf she certainly is too tough. - iosp

      In principle, the answers are correct, I will add a clarification.

      1) Specify explicitly somewhere in the configuration file that UTF-8 encoding is used for mb_ functions, the default is different.

       mb_internal_encoding("UTF-8"); 

      In lower case, you can lead the function mb_strtolower()