Tuesday, October 7, 2025
HomeLanguagesPHP | IntlChar foldCase() Function

PHP | IntlChar foldCase() Function

The IntlChar::foldCase() function is an inbuilt function in PHP which is used to perform case folding on a code point. Case folding means the given character is mapped to its equivalent lowercase characters.
Syntax: 
 

mixed IntlChar::foldCase( $codepoint, $options = 
IntlChar::FOLD_CASE_DEFAULT )

Parameters: This function accepts two parameters as mentioned above and described below: 
 

  • $codepoint: This parameter is a character or integer value, which is encoded as a UTF-8 string.
  • $options: This parameter holds the character constants IntlChar::FOLD_CASE_DEFAULT by default or IntlChar::FOLD_CASE_EXCLUDE_SPECIAL_I.

Return Value: This function returns Simple_Case_Folding of the codepoint. If the codepoint has no case folding equivalent, then the codepoint itself is returned.
Below program illustrates the IntlChar::foldCase() function in PHP:
Program: 
 

php




<?php
// PHP program to illustrate the IntlChar::foldCase() function
 
var_dump(IntlChar::foldCase('AA', IntlChar::FOLD_CASE_EXCLUDE_SPECIAL_I));
 
var_dump(IntlChar::foldCase('@', IntlChar::FOLD_CASE_EXCLUDE_SPECIAL_I));
 
var_dump(IntlChar::foldCase('&', IntlChar::FOLD_CASE_EXCLUDE_SPECIAL_I));
 
var_dump(IntlChar::foldCase('C', IntlChar::FOLD_CASE_DEFAULT));
 
var_dump(IntlChar::foldCase('Lt', IntlChar::FOLD_CASE_DEFAULT));
 
var_dump(IntlChar::foldCase('/', IntlChar::FOLD_CASE_DEFAULT));
 
var_dump(IntlChar::foldCase('g', IntlChar::FOLD_CASE_DEFAULT));
 
var_dump(IntlChar::foldCase('1', IntlChar::FOLD_CASE_DEFAULT));
 
?>


Output: 

NULL
string(1) "@"
string(1) "&"
string(1) "c"
NULL
string(1) "/"
string(1) "g"
string(1) "1"

 

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32340 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6829 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6784 POSTS0 COMMENTS