PHP | IntlChar::charAge() Function
Last Updated :
04 Feb, 2021
The IntlChar::charAge() function is an inbuilt function in PHP which is used to calculate the age of code point. Where the age is Unicode version when the code point was first designated or assigned a character. This can be useful to avoid emitting code points to receiving processes that do not accept newer characters.
Syntax:
array IntlChar::charAge( $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: In true cases the $codepoint return the Unicode version number of an array.
Below programs illustrate the IntlChar::charAge() function in PHP.
Program 1:
PHP
<?php
var_dump(IntlChar::charage( "\u{2025}" ));
echo "<br>" ;
var_dump(IntlChar::charage( "\u{1F878}" ));
echo "<br>" ;
var_dump(IntlChar::charage( "\u20" ));
echo "<br>" ;
var_dump(IntlChar::charage( "Geeks" ));
echo "<br>" ;
?>
|
Output:
array(4) { [0]=> int(1) [1]=> int(1) [2]=> int(0) [3]=> int(0) }
array(4) { [0]=> int(7) [1]=> int(0) [2]=> int(0) [3]=> int(0) }
NULL
NULL
Program 2:
PHP
<?php
$arr = array ( "^" , "2345" , "6" , "\n" );
foreach ( $arr as $val ){
var_dump(IntlChar::charage( $val ));
echo "<br>" ;
}
?>
|
Output:
array(4) { [0]=> int(1) [1]=> int(1) [2]=> int(0) [3]=> int(0) }
NULL
array(4) { [0]=> int(1) [1]=> int(1) [2]=> int(0) [3]=> int(0) }
array(4) { [0]=> int(1) [1]=> int(1) [2]=> int(0) [3]=> int(0) }
Related Articles:
Reference: http://php.net/manual/en/intlchar.charage.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...