PHP ctype_lower() work: Here, we will find out about the ctype_lower() work with the example in PHP.
PHP ctype_lower() work
ctype_lower() work is a character type (CType) work in PHP, it is utilized to check whether a given string contains lowercase characters or not.
It returns genuine, if all characters of the given strings are in lowercase, else it returns false.
Syntax:
ctype_lower(string) : bool
Output:
Input: "hello"
Output: true
Input: "hello world"
Output: false
Input: "Hello"
Output: false
PHP Code:
<?php
$str = "hello";
if(ctype_lower($str))
echo ("$str contains all lowercase characters.\n");
else
echo ("$str does not contain all lowercase characters.\n");
$str = "hello world"; //space is there
if(ctype_lower($str))
echo ("$str contains all lowercase characters.\n");
else
echo ("$str does not contain all lowercase characters.\n");
$str = "hello123"; //digits are there
if(ctype_lower($str))
echo ("$str contains all lowercase characters.\n");
else
echo ("$str does not contain all lowercase characters.\n");
$str = "Hello"; //an uppercase character is there
if(ctype_lower($str))
echo ("$str contains all lowercase characters.\n");
else
echo ("$str does not contain all lowercase characters.\n");
?>
Output:
hello contains all lowercase characters.
hello world does not contain all lowercase characters.
hello123 does not contain all lowercase characters.
Hello does not contain all lowercase characters.