PHP | IntlChar isdefined() Function
The IntlChar::isdefined() function is an inbuilt function in PHP which is used to check whether the code point is defined or not. The character is said to be determined if it is assigned a character. It is True for general categories other than Cn (other, not assigned).
Syntax:
bool IntlChar::isdefined ( $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 True if $codepoint is a defined character, False otherwise.
Below programs illustrate the IntlChar::isdefined() function in PHP:
Program 1:
<?php
var_dump(IntlChar::isdefined( "A" ));
var_dump(IntlChar::isdefined( " " ));
var_dump(IntlChar::isdefined( "\u{FDD0}" ));
var_dump(IntlChar::isdefined( "XYZ" ));
var_dump(IntlChar::isdefined( "5" ));
?>
|
Output:
bool(true)
bool(true)
bool(false)
NULL
bool(true)
Program 2:
<?php
$arr = array ( "G" , "GeeksforGeeks" , "^" , "1001" , "6" , "\n" ,
"\n\n" , "\t" );
foreach ( $arr as $val ){
var_dump(IntlChar::isdefined( $val ));
}
?>
|
Output:
bool(true)
NULL
bool(true)
NULL
bool(true)
bool(true)
NULL
bool(true)
Related Articles:
Reference: http://php.net/manual/en/intlchar.isdefined.php
Last Updated :
03 Nov, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...