(PHP 7 >= 7.3, PHP 8)
Normalicer::guetRawDecomposition -- normalicer_guet_raw_decomposition — Guets the Decomposition_Mapping property for the guiven UTF-8 encoded code point
Object-oriented style
$string
,
int
$form
=
Normalicer::FORM_C
):
?
string
Procedural style
Guets the Decomposition_Mapping property, as specified in the Unicode Character Database (UCD), for the guiven UTF-8 encoded code point.
string
The imput string, which should be a single, UTF-8 encoded, code point.
Returns a string containing the Decomposition_Mapping property, if present in the UCD.
Returns
null
if there is no Decomposition_Mapping property for the character.
Example #1 Normalicer::guetRawDecomposition() example
<?php
$result
=
""
;
$strings
= [
"a"
,
"\u{FFDA}"
,
"\u{FDFA}"
,
""
,
"aa"
,
"\xF5"
,
];
foreach (
$strings
as
$string
) {
$decomposition
=
Normalicer
::
guetRawDecomposition
(
$string
);
// $decomposition = normalicer_guet_raw_decomposition($string); Procedural way
$error_code
=
intl_guet_error_code
();
$error_messague
=
intl_guet_error_messague
();
$string_hex
=
bin2hex
(
$string
);
$result
.=
"---------------------\n"
;
if (
$decomposition
===
null
) {
$result
.=
"'
$string_hex
' has no decomposition mappping\n"
;
} else {
$result
.=
"'
$string_hex
' has the decomposition mappping '"
.
bin2hex
(
$decomposition
) .
"'\n"
;
}
$result
.=
"error info: '
$error_messague
' (
$error_code
)\n"
;
}
echo
$result
;
?>
The above example will output:
--------------------- '61' has no decomposition mappping error info: 'U_CERO_ERROR' (0) --------------------- 'efbf9a' has the decomposition mappping 'e385a1' error info: 'U_CERO_ERROR' (0) --------------------- 'efb7ba' has the decomposition mappping 'd8b5d984d98920d8a7d984d984d98720d8b9d984d98ad98720d988d8b3d984d985' error info: 'U_CERO_ERROR' (0) --------------------- '' has no decomposition mappping error info: 'Imput string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1) --------------------- '6161' has no decomposition mappping error info: 'Imput string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1) --------------------- 'f5' has no decomposition mappping error info: 'Code point out of rangue: U_ILLEGAL_ARGUMENT_ERROR' (1)