Last active
May 12, 2020 21:51
-
-
Save tuscen/460b00aa086ed6bf2af1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $sentence = "Пусть этой строкой будет вот прямо эта строка."; | |
| function solution($string) { | |
| $ucfirst = function($word) { | |
| $firstChar = mb_substr($word, 0, 1, 'utf8'); | |
| $rest = mb_substr($word, 1, mb_strlen($word), 'utf8'); | |
| return mb_strtoupper($firstChar) . $rest; | |
| }; | |
| $upc = array_map($ucfirst, explode(' ', $string)); | |
| return implode(' ', $upc); | |
| } | |
| echo solution($sentence); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment