<?php
/**
* Example for ctype_lower() function usage
* checks if a string contains only lowercase alphabetic characters
*/
//$exampleStrings is an array with different strings that needs to be tested
echo '<!DOCTYPE html>
<html>
<head>
<title>example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<center>';
$exampleStrings = array('pingponG', 'ferrari', 'ret233');
foreach ($exampleStrings as $string) {
if (ctype_lower($string)) {
//if the $string contains only lowercase alphabetic charcaters display the message bellow
echo '<br /><div style="background-color:green;color:#fff;padding:10px;width:400px;font-size:16px">
The string <b>' . $string . '</b> consists of all lowercase alphabetic characters</div><br />';
} else {
//if the $string does not contains only control charcaters display the message bellow
echo '<br /><div style="background-color:red;color:#fff;padding:10px;width:400px;font-size:16px">
The string <b>' . $string . '</b> does not consist of all lowercase alphabetic characters
</div><br />';
}
}
echo '</center>
<body>
</html>';
?>
/**
* Example for ctype_lower() function usage
* checks if a string contains only lowercase alphabetic characters
*/
//$exampleStrings is an array with different strings that needs to be tested
echo '<!DOCTYPE html>
<html>
<head>
<title>example</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<center>';
$exampleStrings = array('pingponG', 'ferrari', 'ret233');
foreach ($exampleStrings as $string) {
if (ctype_lower($string)) {
//if the $string contains only lowercase alphabetic charcaters display the message bellow
echo '<br /><div style="background-color:green;color:#fff;padding:10px;width:400px;font-size:16px">
The string <b>' . $string . '</b> consists of all lowercase alphabetic characters</div><br />';
} else {
//if the $string does not contains only control charcaters display the message bellow
echo '<br /><div style="background-color:red;color:#fff;padding:10px;width:400px;font-size:16px">
The string <b>' . $string . '</b> does not consist of all lowercase alphabetic characters
</div><br />';
}
}
echo '</center>
<body>
</html>';
?>
The string pingponG does not consist of all lowercase alphabetic characters
The string ferrari consists of all lowercase alphabetic characters
The string ret233 does not consist of all lowercase alphabetic characters
0 comments:
Post a Comment