Table of contents Home page
$x = 'hello world'; echo "Conversion of '$x' to '" . mb_convert_case($x, MB_CASE_UPPER) . "'.\n"; $x = 'HELLO WORLD'; echo "Conversion of '$x' to '" . mb_convert_case($x, MB_CASE_LOWER) . "'.\n"; $x = 'hello world'; echo "Conversion of '$x' to '" . mb_convert_case($x, MB_CASE_TITLE) . "'.\n";
mb_internal_encoding('UTF-8'); $x = "\xfcber wasser"; // String encoded in ISO-8859-1 echo mb_convert_encoding("Conversion of '$x' to '" . mb_convert_case($x, MB_CASE_UPPER, 'ISO-8859-1'), 'UTF-8', 'ISO-8859-1') . "'.\n"; $x = "\xdcBER WASSER"; // String encoded in ISO-8859-1 echo mb_convert_encoding("Conversion of '$x' to '" . mb_convert_case($x, MB_CASE_LOWER, 'ISO-8859-1'), 'UTF-8', 'ISO-8859-1') . "'.\n"; $x = "\xfcber wasser"; // String encoded in ISO-8859-1 echo mb_convert_encoding("Conversion of '$x' to '" . mb_convert_case($x, MB_CASE_TITLE, 'ISO-8859-1'), 'UTF-8', 'ISO-8859-1') . "'.\n"; // Because we've explicitly specified the encoding used for the strings (ISO-8859-1), which is different from the // internal encoding (UTF-8), mb_convert_case() still converts the strings correctly. // Note that we assume that the output must be send in UTF-8, so we convert the results of mb_convert_encoding() from // ISO-8859-1 to UTF-8, using mb_convert_encoding(), in order to have the strings displayed correctly.