function mb_str_split($string) {
$length = mb_strlen($string, "utf-8");
$i = 0;
$arr = array();
while ($i < $length) {
$rep = mb_substr($string,$i,1,"utf-8");
array_splice($arr, $i, 1, $rep);
$i++;
}
return $arr;
}
function incode($string) {
$string = mb_str_split($string);
$string = array_map(function($e) {
$result = unpack("N", mb_convert_encoding($e, "UCS-4BE", "UTF-8"));
if (is_array($result) === true) {
return $result[1];
}
}, $string);
return implode("", $string); // $string функция
}
function mb_str_split($string) {
$l = mb_strlen($string, "utf-8");
$arr = array();
for ($i = 0; $i < $l; $i++)
array_splice($arr, $i, 1, mb_substr($string,$i,1,"utf-8"));
return $arr;
}
function incode($string) {
$string = array_map(function($e) {
$result = unpack("N", mb_convert_encoding($e, "UCS-4BE", "UTF-8"));
if (is_array($result) === true) return $result[1];
}, mb_str_split($string));
return implode("", $string); // $string функция
}
function mb_str_split($string) {
return array_map(function ($i) use ($string) {
return mb_substr($string,$i,1,"utf-8");
}, range(0, mb_strlen($string, "utf-8")-1));
}
function incode($string) {
return array_reduce(mb_str_split($string), function($result, $e) {
$convertedString = unpack("N", mb_convert_encoding($e, "UCS-4BE", "UTF-8"));
return $result . (is_array($convertedString) ? $convertedString[1] : '');
}, "");
}