I want to check the user entered characters are lowercase or uppercase. If it is lowercase i want to change into uppercase. If it is uppercase i want to change into lowercase.
<?php
$string=$_POST['string'];
$arr=str_split($string);
$arrlen=strlen($string);
$arrcaps=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ");
$arrsmall=array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," ");
//print_r($arrsmall);
for($i=0;$i<$arrlen;$i++)
{
for($j=0;$j<27;$j++)
{
if($arr[$i]==$arrcaps[$j])
{
echo $arrsmall[$j];
}
}
for($k=0;$k<27;$k++)
{
if($arr[$i]==$arrsmall[$j])
{
echo $arrcaps[$j];
}
}
}
?>
I execute the above program. it change the uppercase characters to lowercase. But it not change the lowercase characters to uppercase.
Where i did mistake. solve this problem.
Thanks in advance...