Lab #1 Exercise #11. Create a function called converter() that will take two arguments. The first argument will be upper, lower, or title. The second argument will be a string. The function should display the string in all uppercase, all lowercase, or as a title (that is, where the first letter in each word is uppercase as in, "Having Fun With Dick and Jane"). The function will be called like this: print converter("title", $string); Click Here to see the output. Side note: You don't need to use forms in Lab 1 Problem 11.
**************************************************************
CODES:
$string = "This is the string to convert. Oh My!";
function converter( $string, $conversionMethod) {
switch($conversionMethod) {
case "upper":
print strtoupper($string)."<br />";
break;
case "lower":
print strtolower($string)."<br />";
break;
case "title":
print ucFirst($string)."<br />";
break;
case "words":
print ucWords($string)."<br />";
break;
default:
print $string."<br />";
break;
}
}
echo "This is the string to convert:<br /> ".$string."<br /><br />";
echo "This is the string converted to all upper capitalization: <br />".converter($string, "upper")."<br />";
echo "This is the string converted to all lower capitalization: <br />".converter( $string,"lower")."<br />";
echo "This is the string converted to a title format: <br />".converter($string, "title")."<br />";
echo "This is the string converted to each word capitalized: <br />".converter($string, "words")."<br />";
**************************************************************
ANSWER: