Monday 26 August 2013

PHP Function ctype_lower()

Syntax

ctype_lower ( $text );

Definition and Usage

Thsi function checkes if all of the characters in the provided string, text, are lowercase letters.

Paramters

ParameterDescription
textRequired. The tested string.

Return Value

Returns TRUE if every character in text is a lowercase letter in the current locale.

Example

Try out following example:
<?php
$strings = array('aac123', 'testing', "testin IS Done");
foreach ($strings as $testcase) {
 if (ctype_lower($testcase)) {
     echo "$testcase consists of all lowercase letters.<br />";
 } else {
     echo "$testcase does not have all lowercase letters.<br />";
 }
}
?> 
This will produce following result:
aac123 does not have all lowercase letters.
testing consists of all lowercase letters.
testin IS Done does not have all lowercase letters.

No comments:

Post a Comment