Skip to content

Instantly share code, notes, and snippets.

@d30jeff
Created October 20, 2015 08:26
Show Gist options
  • Select an option

  • Save d30jeff/f42afab64d921637e6a0 to your computer and use it in GitHub Desktop.

Select an option

Save d30jeff/f42afab64d921637e6a0 to your computer and use it in GitHub Desktop.
Winning Solution
<?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