function decode($string, $array) { $output = ""; $words = explode(" ", $string); foreach ($words as $word) { $upper = isUpper($word); $word = strtolower($word); if ($key = array_search($word, $array)) { if ($upper) { $key = strtoupper($key); } $output = "{$output}{$key}"; } else { $output = "{$output}{$word}"; } } return $output; }
function isChar($s) { return isLower($s) || isUpper($s); }