title: How to capitalize the first letter (with a diacritic) of string in PHP?
body: <p>I need to convert to lowercase some strings/sentences, like this: "<strong>ȘEF DE CABINET</strong>", then to convert to uppercase only <em>the first letter of the first word</em> (<strong>with a diacritic</strong>) of these strings. I found <a href="http://www.php.net/manual/en/function.mb-convert-case.php#99081" rel="nofollow">a function</a> that will convert the first letter <em>of every word</em> from the string. How to adapt it to my needs?</p>
  
  <p>This is the code:</p>
  
  <pre><code>function sentence_case( $s ) {
     $s = mb_convert_case( $s, MB_CASE_LOWER, 'UTF-8' );
     $arr = preg_split("//u", $s, -1, PREG_SPLIT_NO_EMPTY);
     $result = "";
     $mode = false;
     foreach ($arr as $char) {
        $res = preg_match(
           '/\\p{Mn}|\\p{Me}|\\p{Cf}|\\p{Lm}|\\p{Sk}|\\p{Lu}|\\p{Ll}|'.
           '\\p{Lt}|\\p{Sk}|\\p{Cs}/u', $char) == 1;
        if ($mode) {
           if (!$res)
              $mode = false;
        } 
        elseif ($res) {
           $mode = true;
           $char = mb_convert_case($char, MB_CASE_TITLE, "UTF-8");
        }
        $result .= $char;
     }
  
     return $result; 
  }
  </code></pre>