code: public static function convertCase(
          /*# string */ $string,
          /*# string */ $toCase
      )/*# string */ {
          // break into lower case words
          $str = strtolower(ltrim(
              preg_replace(['/[A-Z]/', '/[_]/'], [' $0', ' '], $string)
          ));
  
          switch (strtoupper($toCase)) {
              case 'PASCAL':
                  return str_replace(' ', '', ucwords($str));
              case 'CAMEL' :
                  return lcfirst(str_replace(' ', '', ucwords($str)));
              default: // SNAKE
                  return str_replace(' ', '_', $str);
          }
      }
docs: Convert case of a string.
  
  Supported $toCase are
  
  'PASCAL': PascalCase
  'CAMEL' : camelCase
  'SNAKE' : snake_case
  
  @param  string $string
  @param  string $toCase
  @return string
  @access public
  @static