Skip to content

Instantly share code, notes, and snippets.

@davidon
Last active October 1, 2020 10:23
Show Gist options
  • Save davidon/ea445dc0d857e9add7838b77fb24b069 to your computer and use it in GitHub Desktop.
Save davidon/ea445dc0d857e9add7838b77fb24b069 to your computer and use it in GitHub Desktop.
PHP: Conver a string into StudlyCaps,AKA PascalCase
/**
* 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)));
}
@davidon
Copy link
Author

davidon commented Nov 3, 2018

From eoneopay/utils/src/Str.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment