<?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!";
    }
}
function splitStr($str)
Example #2
0
 /**
  * Return a hashed string of $value.
  *
  * @param boolean $salt  Include salt.
  * @param string  $field Field to hash.
  *
  * @return string
  */
 public function hash($salt = false, $field = 'id')
 {
     return hashStr($this->get($field), $salt);
 }