How would I go about making the following also check if the last character of $word is equal to “h” if true then append “es”? This check for “h” would be before the check for “s” and if true there would be no need to check for “s”.
<?php
$word = "watch";
$newword = "$word".(substr($word, -1)=="s"?"":"s")." is the new word";
echo $newword;
?>
Or some variation thereof. If you are trying to pluralize words, there are already a number of solutions, for example: pluralize method