<html> <?php include "include_with_-function.php"; if (isset($_GET['string'])) { $result = myChangeCase($_GET['string']); echo $result; } ?> <body> <form action="to_upper_case.php" method="get" align="center"> Given String: <input type="text" name="string"><br><br> <button type="submit">Result</button> </form> </body> </html>
function setUpperCase($string) { $result = myChangeCase($string); $this->str = $result; return $this->str; }
<html> <?php include "up_to_low.php"; if (isset($_GET['string1']) && isset($_GET['string2'])) { $string1 = $_GET['string1']; $string2 = $_GET['string2']; $str1 = myChangeCase($string1); $str2 = myChangeCase($string2); $result = dictionary($str1, $str2); echo $result; } function dictionary($str1, $str2) { $dic = ""; $length1 = strlen($str1); $length2 = strlen($str2); if ($length1 <= $length2) { $len = $length1; } else { $len = $length2; } for ($i = 0; $i < $len; $i++) { if ($str1[$i] == $str2[$i]) { $dic .= $str1[$i]; continue; } elseif ($str1[$i] != $str2[$i]) { if ($str1[$i] < $str2[$i]) { return $str1; } else { return $str2; }