Skip to content

Instantly share code, notes, and snippets.

@friartuck6000
Created September 7, 2016 13:15
Show Gist options
  • Save friartuck6000/57dd26da8ba4add24845af6055815ee6 to your computer and use it in GitHub Desktop.
Save friartuck6000/57dd26da8ba4add24845af6055815ee6 to your computer and use it in GitHub Desktop.
Convert camel case to snake case
<?phpunction camel2snake($camelString)
{
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $camelString));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment