PHP | IntlChar tolower() Function
Last Updated :
27 Aug, 2019
The IntlChar::tolower() function is an inbuilt function in PHP which is used to convert the character into Unicode lowercase character. The given input character is mapped to its lowercase character equivalent. If the character has no lowercase equivalent then it returns the character itself.
Syntax:
mixed IntlChar::tolower ( $codepoint )
Parameters: This function accepts single parameter $codepoint which is mandatory. The input parameter is a character, which is encoded as a UTF-8 string.
Return Value: This function returns the lowercase mapping character of given character. If the character has no lowercase mapped character then it returns itself. The return type will be integer unless the code point was passed as a UTF-8 string, in which case a string will be returned.
Below programs illustrate the IntlChar::tolower() function in PHP:
Program 1:
<?php
var_dump(IntlChar::tolower( "A" ));
var_dump(IntlChar::tolower( "a" ));
var_dump(IntlChar::tolower( "1" ));
var_dump(IntlChar::tolower(ord( "XYZ" )));
var_dump(IntlChar::tolower(ord( "I" )));
?>
|
Output:
string(1) "a"
string(1) "a"
string(1) "1"
int(120)
int(105)
Program 2:
<?php
$arr = array (ord( "A" ), "291" , "^" , "A" , "a" , "1" );
foreach ( $arr as $val ){
var_dump(IntlChar::tolower( $val ));
}
?>
|
Output:
int(97)
NULL
string(1) "^"
string(1) "a"
string(1) "a"
string(1) "1"
Related Articles:
Reference: http://php.net/manual/en/intlchar.tolower.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...