Last active
October 1, 2020 10:23
-
-
Save davidon/ea445dc0d857e9add7838b77fb24b069 to your computer and use it in GitHub Desktop.
PHP: Conver a string into StudlyCaps,AKA PascalCase
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
/** | |
* Convert a value to studly caps case. | |
* | |
* @param string $value | |
* | |
* @return string | |
*/ | |
public function studly(string $value): string | |
{ | |
return \str_replace(' ', '', \ucwords(\str_replace(['-', '_'], ' ', $value))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From eoneopay/utils/src/Str.php