Open In App

PHP | IntlChar getFC_NFKC_Closure() Function

Improve
Improve
Like Article
Like
Save
Share
Report

The IntlChar::getFC_NFKC_Closure() function is an inbuilt function in PHP which is used to get the FC_NFKC_Closure property for a code point. This function returns the FC_NFKC_Closure property string for the code point. If the code point is none then it returns an empty string.

Syntax:

string IntlChar::getFC_NFKC_Closure( $codepoint )

Parameters: This function accepts a single parameter $codepoint which is mandatory. The $codepoint value is an integer values or character, which is encoded as a UTF-8 string.

Return Value: This function returns the FC_NFKC_Closure property string for the code point, or an empty string if there is none.

Below programs illustrate the IntlChar::getFC_NFKC_Closure() function in PHP:

Program 1:




<?php
   
// PHP function to illustrate 
// the use of IntlChar::getFC_NFKC_Closure()
   
// Input data is unicode character type
var_dump(IntlChar::getFC_NFKC_Closure("\u{2121}"));
  
// Input data is unicode character type
var_dump(IntlChar::getFC_NFKC_Closure("\u{1D2D}"));
  
// Input data is string type
var_dump(IntlChar::getFC_NFKC_Closure("\p{143}"));
   
// Input data is character type
var_dump(IntlChar::getFC_NFKC_Closure(" "));
   
// Input data is unicode character type
var_dump(IntlChar::getFC_NFKC_Closure("\u{350}"));
   
// Input data is string type
var_dump(IntlChar::getFC_NFKC_Closure("XYZ"));
   
// Input data is unicode character type
var_dump(IntlChar::getFC_NFKC_Closure("\u{0358}"));
   
?>


Output:

string(3) "tel"
string(2) "æ"
NULL
string(0) ""
string(0) ""
NULL
string(0) ""

Program 2:




<?php
// PHP code to illustrate getFC_NFKC_Closure()
       
// Declare an array $arr
$arr = array("\u{2121}", "\u{1D2D}", " ", "\u{350}", "XYZ", "G",
                "GeeksforGeeks", "^");
      
// Loop run for every array element
foreach ($arr as $val){
          
    // Check each element as code point data
    var_dump(IntlChar::getFC_NFKC_Closure($val));
}
?>


Output:

string(3) "tel"
string(2) "æ"
string(0) ""
string(0) ""
NULL
string(0) ""
NULL
string(0) ""

Related Articles:

Reference: http://php.net/manual/en/intlchar.getfc-nfkc-closure.php



Last Updated : 03 Nov, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads