Search code examples
phphexhtml-entitieslowercase

PHP: Convert html-entity-encoded uppercase character to lowercase


How can I convert the upper-case html entity characters to their lowercase?

$str = "É"; //É

$res = strtolower( $str );

echo $res;

http://codepad.viper-7.com/Zf3RTe


Solution

  • $str = "É"; //É
    
    $res = mb_strtolower(html_entity_decode($str,ENT_COMPAT|ENT_HTML401,'UTF-8'),'UTF-8' );
    
    echo $res;