Приведение первого символа к верхнему регистру для многобайтовых строк

  1. function mb_ucfirst($str, $charset = ''){
  2. if($charset == '') $charset = mb_internal_encoding();
  3. $letter = mb_strtoupper(mb_substr($str, 0, 1, $charset), $charset);
  4. $suffix = mb_substr($str, 1, mb_strlen($str, $charset) - 1, $charset);
  5. return $letter.$suffix;
  6. }
Russian
Категория: 
The code has been tested and works
Мультитег: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Target Image