Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
IntlChar getFC_NFKC_Closure() function in PHP
The IntlChar::getFC_NFKC_Closure() function retrieves the FC_NFKC_Closure property for a given Unicode character. This property contains the string that the character maps to under NFKC (Normalization Form KC) normalization closure.
Syntax
IntlChar::getFC_NFKC_Closure(mixed $codepoint)
Parameters
codepoint − An integer codepoint value or a character encoded as a UTF−8 string.
Return Value
Returns the FC_NFKC_Closure property string for the given character, or null if the character has no FC_NFKC_Closure mapping.
Example
The following example demonstrates the function with various Unicode characters −
<?php
// Test with different Unicode characters
echo "Testing FC_NFKC_Closure property:<br>";
// Roman numeral II (U+2161)
$result1 = IntlChar::getFC_NFKC_Closure(0x2161);
echo "Roman numeral II (U+2161): ";
var_dump($result1);
// Superscript two (U+00B2)
$result2 = IntlChar::getFC_NFKC_Closure(0x00B2);
echo "Superscript two (U+00B2): ";
var_dump($result2);
// Regular letter 'A'
$result3 = IntlChar::getFC_NFKC_Closure(ord('A'));
echo "Regular letter 'A': ";
var_dump($result3);
// Angstrom sign (U+212B)
$result4 = IntlChar::getFC_NFKC_Closure(0x212B);
echo "Angstrom sign (U+212B): ";
var_dump($result4);
?>
Testing FC_NFKC_Closure property: Roman numeral II (U+2161): string(2) "II" Superscript two (U+00B2): string(1) "2" Regular letter 'A': NULL Angstrom sign (U+212B): string(2) "Å"
Key Points
The function returns
nullfor characters that don't have an FC_NFKC_Closure mappingCharacters like Roman numerals and superscripts typically have closure mappings to their decomposed forms
Regular ASCII characters usually return
nullsince they don't need normalizationThis function is part of Unicode normalization and is useful for text processing applications
Conclusion
The IntlChar::getFC_NFKC_Closure() function helps identify Unicode characters that have special normalization mappings, making it valuable for proper text handling and Unicode normalization processes.
