Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
IntlChar tolower() function in PHP
The IntlChar::tolower() function converts a Unicode character to its lowercase equivalent. This function is part of PHP's Intl extension and works with Unicode codepoints and UTF-8 encoded characters.
Syntax
IntlChar::tolower(mixed $codepoint)
Parameters
codepoint − An integer representing a Unicode codepoint value, or a character encoded as a UTF-8 string.
Return Value
The function returns the lowercase equivalent of the given character. If the character is already lowercase or has no lowercase mapping, the same character is returned. Returns NULL on failure or for invalid input.
Example
The following example demonstrates converting various characters to lowercase ?
<?php
// Converting uppercase letters
var_dump(IntlChar::tolower("A"));
echo "<br>";
// Already lowercase letter
var_dump(IntlChar::tolower("k"));
echo "<br>";
// Uppercase letter M
var_dump(IntlChar::tolower("M"));
echo "<br>";
// Number (no case conversion)
var_dump(IntlChar::tolower("5"));
echo "<br>";
// Using Unicode codepoint for 'Z' (90)
var_dump(IntlChar::tolower(90));
?>
Output
string(1) "a" string(1) "k" string(1) "m" string(1) "5" string(1) "z"
Key Points
Only works with single characters, not strings
Returns NULL for multi-character strings or invalid input
Numbers and special characters remain unchanged
Supports Unicode codepoint integers as input
Conclusion
The IntlChar::tolower() function provides Unicode-aware lowercase conversion for individual characters. Use it when you need proper case conversion that handles international characters correctly.
