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 null for characters that don't have an FC_NFKC_Closure mapping

  • Characters like Roman numerals and superscripts typically have closure mappings to their decomposed forms

  • Regular ASCII characters usually return null since they don't need normalization

  • This 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.

Updated on: 2026-03-15T07:50:33+05:30

106 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements