The ctype_lower method checks if all the text characters are in lowercase alphabetical characters.
The lowercase alphabetical characters include
a-z.
ctype_lower(mixed $text): bool
This method returns a Boolean value.
<?php$str = "abc";printIsLower($str);$str = "aaaaa";printIsLower($str);$str = "A";printIsLower($str);$str = "123abc";printIsLower($str);function printIsLower($str){echo "The string is: ". $str. "\n";echo "Is Lower: ";var_dump(ctype_lower($str));echo "---------\n";}?>
In the code above:
We used the ctype_lower method to check if the string contains only lowercase alphabetical characters.
For the string abc and aaaa, the ctype_lower method returns true.
But for the string A and 123abc, the ctype_lower method returns false because the string contains the uppercase letter A and numeric characters, respectively.
If an int value ranging from -128 to 128 is passed as an argument, it is internally converted as an ASCII character. Then it is checked if the converted character is a numeric character. See the example below.
<?phpvar_dump(ctype_lower(97)); // 97 is equivalent to charcter `a` in ASCII?>
In the code above, we passed 97 as an argument. First, it is internally converted as ASCII character a and then checked if it is a lowercase alphabetical character. a is a lowercase character, so true is returned.