Created
October 20, 2015 08:26
-
-
Save d30jeff/f42afab64d921637e6a0 to your computer and use it in GitHub Desktop.
Winning Solution
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 $retardadize = function($string, $firstRetard) {$each = str_split(strtolower($string));$ultimateRetardSolution = "";$retardPotion = ($firstRetard) ? true : false;foreach ($each as $x ) {if ($retardPotion) {$ultimateRetardSolution .= strtoupper($x);$retardPotion = (ctype_space($x)) ?: false;} else {$ultimateRetardSolution .= strtolower($x);$retardPotion = (ctype_space($x)) ?: true;}}return $ultimateRetardSolution;};echo $retardadize("Hello World", true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment