Merge pull request #1110 from francescom/master

Incapsulated definitions of mb_ord and mb_chr into a if(!function_exi…
This commit is contained in:
Kent Safranski
2020-03-21 08:53:04 -05:00
committed by GitHub

View File

@@ -2071,14 +2071,18 @@ define('Match_MaxBits', PHP_INT_SIZE * 8);
function charCodeAt($str, $pos) {
return mb_ord(mb_substr($str, $pos, 1));
}
function mb_ord($v) {
$k = mb_convert_encoding($v, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
if(!function_exists('mb_ord')) {
function mb_ord($v) {
$k = mb_convert_encoding($v, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
}
}
function mb_chr($num){
return mb_convert_encoding('&#'.intval($num).';', 'UTF-8', 'HTML-ENTITIES');
if(!function_exists('mb_chr')) {
function mb_chr($num){
return mb_convert_encoding('&#'.intval($num).';', 'UTF-8', 'HTML-ENTITIES');
}
}
/**