Computer >> Computer tutorials >  >> Programming >> PHP

IntlChar::totitle() function in PHP


The IntlChar::totitle() function is used to check whether the entered value is a Unicode character titlecase or not.

Syntax

IntlChar::totitle(val)

Parameters

  • val − A character or integer value encoded as a UTF-8 string.

Return

The IntlChar::to title() function returns the simple_Titlecase_Mapping of the code point, if any; otherwise the code point itself.

Example

The following is an example:

<?php
   var_dump(IntlChar::totitle(" "));
   echo "<br>";
   var_dump(IntlChar::totitle(" $ "));
   echo "<br>";
   var_dump(IntlChar::totitle("78"));
   echo "<br>";
   var_dump(IntlChar::totitle("k"));
?>

Output

The following is the output −

string(1) " "
NULL
NULL
string(1) "K"