Skip to content

Instantly share code, notes, and snippets.

@mattkomarnicki
Created October 29, 2019 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattkomarnicki/c303cf6d2497a40776998a8e404940ac to your computer and use it in GitHub Desktop.
Save mattkomarnicki/c303cf6d2497a40776998a8e404940ac to your computer and use it in GitHub Desktop.
<?php
private function camelCaseToHuman(string $input): string
{
$result = preg_split('/(^[^A-Z]+|[A-Z][^A-Z]+)/', $input, -1, PREG_SPLIT_NO_EMPTY| PREG_SPLIT_DELIM_CAPTURE);
return ucfirst(implode(' ', $result));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment