Для получения полного доступа
зарегистрируйтесь.
RSS

All snippets tagged with "ucfirst" tag



Snippet,  PHP

mb_ucfirst

samdark
  • Reputation: 349
  • Snippets: 57
  • Revisions: 5

Mulibyte versions of ucfirst() which works well with unicode.

function mb_ucfirst($string, $encoding = 'UTF-8') {
  $firstChar = mb_strtoupper(mb_substr($string, 0, 1, $encoding), $encoding);
  return $firstChar . mb_substr($string, 1, mb_strlen($string, $encoding), $encoding);
}