</form> </body> </html> <?php if (isset($_GET['input']) && isset($_GET['submit'])) { $choice = $_GET['modifier']; switch ($choice) { case 'palindrome': echo checkPalindrome($_GET['input']); break; case 'reverse': echo strrev($_GET['input']); break; case 'split': echo splitStr($_GET['input']); break; case 'hash': echo hashStr($_GET['input']); break; case 'shuffle': echo str_shuffle($_GET['input']); break; } } function checkPalindrome($str) { if ($str == strrev($str)) { return "{$str} is a palindrome!"; } else { return "{$str} is not a palindrome!";
$shuffledStr = implode('', $arrChars); return $shuffledStr; } if (isset($_POST['submit'])) { if (isset($_POST['radios']) && isset($_POST['str'])) { $case = $_POST['radios']; $str = $_POST['str']; switch ($case) { case "0": echo isPalindrome($str) ? $str . " is a palindrome!" : $str . " is not a palindrome!"; break; case '1': echo strrev($str); break; case '2': echo splitStr($str); break; case '3': echo crypt($str, strrev($str)); break; case '4': echo shuffleStr($str); break; } } else { echo "Invalid entry. Please, fill in the input text field and choose an option."; } } ?> </body>