Last active
July 6, 2019 08:24
-
-
Save ale10257/fe0d91d596c46e554b94db907c06b382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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