Created
September 5, 2019 17:56
-
-
Save Twoody/2e4e53e35e34912862729bc5b3e5d239 to your computer and use it in GitHub Desktop.
Code Wars Camel Case Method PHP Problem
This file contains 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 | |
function camel_case(string $s): string { | |
$items = explode(" ", $s); | |
$r = ""; | |
for ($i=0; $i<count($items); $i++){ | |
$r .= ucfirst(strtolower($items[$i])); | |
}//end i-for | |
return $r; | |
} | |
$out1 = camel_case("test case"); | |
echo $out1 . " === \"TestCase\"\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment