Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // This will make sure the value returned is an array
- function wordsToUpper($string) : array {
- if (empty($string) || is_null($string)) {
- return [];
- }
- $string = explode(' ', $string);
- return array_map('strtoupper', $string);
- }
- $input = '';
- $converted = wordsToUpper($input);
- echo '<pre>';
- print_r($converted);
- echo '</pre>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement