Skip to content
Related Articles

Related Articles

Improve Article

PHP | IntlChar istitle() Function

  • Last Updated : 16 Feb, 2021

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 integer 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: 
 

php




<?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"));
    
?>
Output: 
NULL
bool(false)
bool(false)
bool(false)
bool(false)
NULL
bool(false)

 

Program 2: 
 

php




<?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));
}
?>
Output: 
bool(false)
bool(false)
bool(false)

 

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :