PHP | IntlChar istitle() Function

The IntlChar::istitle function is an inbuilt function in PHP which is used to check whether the input character code point is a titlecase letter or not. In True cases, the characters with the general category are “Lt” (titlecase letter).

Syntax:

bool IntlChar::istitle( $codepoint )

Parameters: This function accepts a single parameter $codepoint which is mandatory. The input parameter $codepoint is a character or interger value, which is encoded as a UTF-8 string.

Return Value: Returns True, if $codepoint is a titlecase letter, otherwise return False.

Below programs illustrate the IntlChar::istitle() Function in PHP:



Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP function to illustrate the
//use of IntlChar::istitle()
     
// Input Capital letter  codepoint
var_dump(IntlChar::istitle("Welcome to Geeks"));
    
// Input Capital letter  codepoint
var_dump(IntlChar::istitle("\u{03A6}"));
    
// Input Capital letter  codepoint
var_dump(IntlChar::istitle("?"));
    
// Input int char an identifier
// of codepoint value
var_dump(IntlChar::istitle("\u{00A0}"));
     
// Input symbolic space codepoint value 
var_dump(IntlChar::istitle(" "));
   
// Input symbolic codepoint value 
var_dump(IntlChar::istitle(" ^ "));
  
// Input int codepoint value 
var_dump(IntlChar::istitle("3"));
     
?>

chevron_right


Output:

NULL
bool(false)
bool(false)
bool(false)
bool(false)
NULL
bool(false)

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP function to illustrate the
// use of IntlChar::istitle()
   
// Declare an array with
// different codepoint value 
$arr = array("G",
             "\u{03C6}"
             "\t",
        );
     
// For loop condition to check 
// each character through function
foreach ($arr as $val) {
         
    // Check each element as code point data
    var_dump(IntlChar::istitle($val));
}
?>

chevron_right


Output:

bool(false)
bool(false)
bool(false)

Reference: https://www.php.net/manual/en/intlchar.istitle.php




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.