Wednesday, November 20, 2024
Google search engine
HomeLanguagesPHP | IntlChar getFC_NFKC_Closure() Function

PHP | IntlChar getFC_NFKC_Closure() Function

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",
                "neveropen", "^");
      
// 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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments