Created
September 12, 2015 08:56
-
-
Save kirilkirkov/20e10d9eb21dea6020db to your computer and use it in GitHub Desktop.
Convert the first character of "word" to uppercase (Multi Byte Helper For CodeIgniter)
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 | |
if (!defined('BASEPATH')) | |
exit('No direct script access allowed'); | |
function mb_ucfirst($str, $encoding = "UTF-8", $lower_str_end = false) { | |
$first_letter = mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding); | |
$str_end = ""; | |
if ($lower_str_end) { | |
$str_end = mb_strtolower(mb_substr($str, 1, mb_strlen($str, $encoding), $encoding), $encoding); | |
} else { | |
$str_end = mb_substr($str, 1, mb_strlen($str, $encoding), $encoding); | |
} | |
$str = $first_letter . $str_end; | |
return $str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment