Skip to content

Instantly share code, notes, and snippets.

@ale10257
Last active July 6, 2019 08:24
Show Gist options
  • Save ale10257/fe0d91d596c46e554b94db907c06b382 to your computer and use it in GitHub Desktop.
Save ale10257/fe0d91d596c46e554b94db907c06b382 to your computer and use it in GitHub Desktop.
<?php
namespace app\components\helpers;
class FirstUpperCase
{
public static function get($string, $encoding = 'UTF-8')
{
$strlen = mb_strlen($string, $encoding);
$firstChar = mb_substr($string, 0, 1, $encoding);
$then = mb_substr($string, 1, --$strlen, $encoding);
return mb_strtoupper($firstChar, $encoding) . $then;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment