Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save d30jeff/153d04bb91804dbb4171 to your computer and use it in GitHub Desktop.
Ultimate Retard 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", false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment