PHP IntlChar toupper () function

PHP

Syntax:
mixed IntlChar::toupper ($codepoint)
Parameters: This function takes one parameter, $codepoint, which is required. An integer value $codepoint (for example, 0x2603 for U + 2603 SNOWMAN) or a character encoded as a UTF-8 string (for example, "/ u {2603}").Return Value:This function returns the uppercase mapped character of the given character. If the given character does not have an uppercase-mapped character, it returns the character itself. The return type will be an integer, unless the code point was passed as a UTF-8 string, in which case the string will be returned.The programs below illustrate the IntlChar::toupper() functionin PHP:Program 1:  
// PHP illustration program
// IntlChar::toupper function 
// Input data - top character register var_dump (IntlChar::toupper ( "A" ));  
// Input - lower case var_dump (IntlChar::toupper ( "a" ));  
// Input is a number character var_dump (IntlChar::toupper ( "1" ));  
// Input is a string character var_dump (IntlChar::toupper (ord ( "xyz" )) );  
// Input - upper case var_dump (IntlChar::toupper (ord ( "I" ) )); ?>
Exit:
string (1 ) "A" string (1) "A" string (1) "1" int (88) int (73)
Program 2:
// PHP code for illustration IntlChar::toupper()  
// Declare the $arr array $arr = array (ord ( "A" ), "291" , "^" , "A" , "a" , "1" ) ;  
// run loop for each array element foreach ( $arr as $val ) { // Validate each element as code point data var_dump (IntlChar::toupper ( $val )); }
?>
Exit:
int (65 ) NULL string (1) "^" string (1) "A" string (1) "A" string (1) "1"
Related Articles:
  • PHP | IntlChar::islower() Function
  • PHP | IntlChar::isupper() function
Link: http://php.net/manual/en/intlchar.toupper.php



Get Solution for free from DataCamp guru