Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utf8.php
Show First 20 Lines • Show All 783 Lines • ▼ Show 20 Lines | |||||
* @{function:strtolower}. | * @{function:strtolower}. | ||||
* | * | ||||
* @param string UTF-8 input string. | * @param string UTF-8 input string. | ||||
* @return string Input, in some semblance of lower case. | * @return string Input, in some semblance of lower case. | ||||
* | * | ||||
* @phutil-external-symbol function mb_convert_case | * @phutil-external-symbol function mb_convert_case | ||||
*/ | */ | ||||
function phutil_utf8_strtolower($str) { | function phutil_utf8_strtolower($str) { | ||||
if ($str === null) { | |||||
return ''; | |||||
} | |||||
if (function_exists('mb_convert_case')) { | if (function_exists('mb_convert_case')) { | ||||
return mb_convert_case($str, MB_CASE_LOWER, 'UTF-8'); | return mb_convert_case($str, MB_CASE_LOWER, 'UTF-8'); | ||||
} | } | ||||
static $map; | static $map; | ||||
if ($map === null) { | if ($map === null) { | ||||
$map = array_combine( | $map = array_combine( | ||||
range('A', 'Z'), | range('A', 'Z'), | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0