Created
February 15, 2023 13:53
-
-
Save ExtevaXT/c3da7666eee25e89b38657c4117f2096 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
| function ToCamelCase($string){ | |
| // Max durability -> maxDurability | |
| $words = explode(' ',strtolower($string)); | |
| $humps = array_slice($words, 1); | |
| $humps = array_map('ucfirst', $humps); | |
| array_unshift($humps , $words[0]); | |
| return implode($humps); | |
| } | |
| echo ToCamelCase('Max durability'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment