diff --git a/script.php b/script.php index 6c602a5..89905bf 100644 --- a/script.php +++ b/script.php @@ -48,15 +48,19 @@ function characters($count) { return $words; } -if ($type === 'characters') { - echo ucfirst(characters($length)); -} -elseif ($type === 'words') { - echo ucfirst($lipsum->words($length)); -} -elseif ($type === 'sentences') { - echo ucfirst($lipsum->sentences($length)); -} -elseif ($type === 'paragraphs') { - echo ucfirst($lipsum->paragraphs($length)); +switch ($type) { + case 'characters': + $output = characters($length); + break; + case 'words': + $output = $lipsum->words($length); + break; + case 'sentences': + $output = $lipsum->sentences($length); + break; + case 'paragraphs': + $output = $lipsum->paragraphs($length); + break; } + +echo ucfirst($output); \ No newline at end of file