update page now
PHP 8.1.34 Released!

Voting

: max(three, two)?
(Example: nine)

The Note You're Voting On

mingalevme at gmail dot com
12 years ago
Implementation of multi-bytes ucfirst for "multiword"-strings (module mbstring is required):

<?php

public static function ucfirst($str)
{
    $str = mb_strtolower($str);
    $words = preg_split('/\b/u', $str, -1, PREG_SPLIT_NO_EMPTY);
    foreach ($words as $word) {
        $ucword = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1);
        $str = str_replace($word, $ucword, $str);
    }
    return $str;
}

?>

<< Back to user notes page

To Top