Pig Latin Generator
HERE;
} else {
//there is a value, so we'll deal with it
//break phrase into array
$words = split(" ", $inputString);
foreach ($words as $theWord){
$theWord = rtrim($theWord);
$firstLetter = substr($theWord, 0, 1);
$restOfWord = substr($theWord, 1, strlen($theWord));
//print "$firstLetter) $restOfWord
\n";
if (strstr("aeiouAEIOU", $firstLetter)){
//it's a vowel
$newWord = $theWord . "way";
} else {
//it's a consonant
$newWord = $restOfWord . $firstLetter . "ay";
} //end if
$newPhrase = $newPhrase . $newWord . " ";
} //end of foreach
print $newPhrase;
} //end if
?>