<?php
$string = "Hello";
$string_length = strlen($string); // calculate the string length
for($i=0;$i<$string_length;$i++){
$current_ascii = ord($string{$i}); // convert to ascii code
if($current_ascii>64 && $current_ascii<91){ //If Upper case
$toggled_string .= chr($current_ascii+32); // Make lower case
}elseif($current_ascii>96 && $current_ascii<123){ // If lower case
$toggled_string .= chr($current_ascii-32); // Make Upper case
}else{
$toggled_string .= $string{$i}; // Do Nothing
}
}
echo "The toggled case letter for $string is ".$toggled_string; // output will be hELLO
?>