How to use ctype_lower() to checks if all of the characters in a string are lowercase letters in PHP

1 Answer

0 votes
$str = array('abc123', 'abc', 'Abc');
foreach ($str as $s) 
{
    if (ctype_lower($s)) 
        echo "string: $s - include only lowercase letters <br />";
    else 
        echo "string: $s - NOT include only lowercase letters <br />";
}


/*
run: 

string: abc123 - NOT include only lowercase letters
string: abc - include only lowercase letters
string: Abc - NOT include only lowercase letters 

*/

 



answered Jun 6, 2016 by avibootz
...