-2

I've looked around a long time now, and all the alternatives and the mb_ functions are not working, any tips for why that might be? If you need any info on my servers part, I can provite that.

1 Answers1

-1

This works (I know it does, I'm using it in my own projects)

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

Use it as mb_ucfirst($string);

Complete example:

<?php
 $string = mb_ucfirst("ååååeee"); 
 echo $string;

 function mb_ucfirst($string, $encoding='UTF-8') {
  $firstChar = mb_substr($string, 0, 1, $encoding);
  $then = mb_substr($string, 1, mb_strlen($string, $encoding)-1, $encoding);
  return mb_strtoupper($firstChar, $encoding) . $then;
 } // end function mb_ucfirst
?>
junkfoodjunkie
  • 3,168
  • 1
  • 19
  • 33