The IntlChar::isIDPart() function is an inbuilt function in PHP which is used to check whether the given input character is permissible in an identifier or not. It is True for characters with general category “L” (Letters), “Nd” (Decimal digits), “Nl” (letters numbers), “Mc” and “Mn”(Combining marks), “Pc” (Connecting Punctuation) and u_isIDIgnorable(c).
Syntax:
bool IntlChar::isIDPart( $codepoint )
Parameters: This function accepts a single parameter $codepoint which is mandatory. The input parameter is a character or integer value, which is encoded as a UTF-8 string.
Return Value: If $codepoint is an identifier character then returns True, otherwise return False.
Below programs illustrate the IntlChar::isIDPart() Function in PHP:
Program 1:
php
<?php
var_dump(IntlChar::isIDPart( "X" ));
var_dump(IntlChar::isIDPart( "Geeks" ));
var_dump(IntlChar::isIDPart( "^ " ));
var_dump(IntlChar::isIDPart( "3 " ));
var_dump(IntlChar::isIDPart( "\u{007F}" ));
var_dump(IntlChar::isIDPart( "\u{012C}" ));
?>
|
Output:
bool(true)
NULL
NULL
NULL
bool(true)
bool(true)
Program 2:
php
<?php
$arr = array ( "D" ,
"\u{007F}" ,
"." ,
"8" ,
"/" ,
" "
);
foreach ( $arr as $val ) {
var_dump(IntlChar::isIDPart( $val ));
}
?>
|
Output:
bool(true)
bool(true)
bool(false)
bool(true)
bool(false)
bool(false)
Related Articles:
Reference: http://php.net/manual/en/intlchar.isidpart.php
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks 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!
Last Updated :
05 Apr, 2021
Like Article
Save Article