The IntlChar::totitle() function is an inbuilt function in PHP which is used to check whether the input code point is a Unicode character titlecase or not.
Syntax:
mixed IntlChar::totitle( $codepoint )
Parameters: This function accepts a single parameter $codepoint which is mandatory. The $codepoint parameter is a character or interger value, which is encoded as a UTF-8 string.
Return Value: Returns the simple_Titlecase_Mapping of the code point, if any; otherwise the code point itself. The return type will be an 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::totitle() Function in PHP:
Program 1:
<?php // PHP function to illustrate the // use of IntlChar::totitle() // Input Capital letter codepoint var_dump(IntlChar::totitle("G")); // Input Capital letter codepoint var_dump(IntlChar::totitle("g")); // Input Capital letter codepoint var_dump(IntlChar::totitle("a")); // Input int char an identifier // of codepoint value var_dump(IntlChar::totitle("\u{00A0}")); // Input symbolic space codepoint value var_dump(IntlChar::totitle(" ")); // Input symbolic codepoint value var_dump(IntlChar::totitle(" ^ ")); // Input int codepoint value var_dump(IntlChar::totitle("9")); // Input control character codepoint value var_dump(IntlChar::totitle("\n")); // Input character value // return its ASCII value var_dump(IntlChar::totitle(ord("D"))); var_dump(IntlChar::totitle(ord("d"))); // Input ASCII value 0054 is "T" var_dump(IntlChar::totitle(ord("0054"))); var_dump(IntlChar::totitle(ord("@"))); ?> |
Output:
string(1) "G" string(1) "G" string(1) "A" string(2) " " string(1) " " NULL string(1) "9" string(1) " " int(68) int(68) int(48) int(64)
Program 2:
<?php // PHP function to illustrate the // use of IntlChar::totitle() // Declare an array with // different codepoint value $arr = array("X", "x", "*", "8", "0", " ", ); // For loop condition to check // each character through function foreach ($arr as $val) { // Check each element as code point data var_dump(IntlChar::totitle($val)); } ?> |
Output:
string(1) "X" string(1) "X" string(1) "*" string(1) "8" string(1) "0" string(1) " "
Related Articles:
- IntlChar::isspace() Function
- IntlChar::isIDIgnorable() Function
- IntlChar::isIDStart() Function
- IntlChar::isIDPart() Function
Reference: http://php.net/manual/en/intlchar.totitle.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to Check a Function is a Generator Function or not using JavaScript ?
- How to get the function name inside a function in PHP ?
- How to get the function name from within that function using JavaScript ?
- PHP | Ds\Set contains() Function
- D3.js | d3.map.has() Function
- PHP | Ds\Map first() Function
- PHP | max( ) Function
- PHP Ds\Map sum() Function
- D3.js | d3.sum() function
- D3.js | d3.map.get() Function
- p5.js | nfc() function
- p5.js | nf() Function
- PHP | each() Function
- p5.js | nfs() Function
- p5.js | nfp() Function
- PHP | min( ) Function
- p5.js | value() Function
- PHP | Ds\Map xor() Function
- D3.js | d3.set.has() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

