public static function ucfirst($string, $locale = false, $charset = null)
    {
        if ($locale) {
            if (is_null($charset)) {
                throw new InvalidArgumentException('$charset argument must not be null');
            }
            $first = self::substr($string, 0, 1, $charset);
            if (self::isAlpha($first, $charset)) {
                $string = self::upper($first, true, $charset) . self::substr($string, 1, null, $charset);
            }
        } else {
            $string = self::upper(substr($string, 0, 1), false) . substr($string, 1);
        }

        return $string;
    }
public static function ucfirst($string, $locale = false, $charset = null)
    {
        if ($locale) {
            if (is_null($charset)) {
                throw new InvalidArgumentException('$charset argument must not be null');
            }
            $first = self::substr($string, 0, 1, $charset);
            if (self::isAlpha($first, $charset)) {
                $string = self::upper($first, true, $charset) . self::substr($string, 1, null, $charset);
            }
        } else {
            $string = self::upper(substr($string, 0, 1), false) . substr($string, 1);
        }

        return $string;
    }
public static function ucfirst ( $ string , $ locale = false , $ charset = null ) { if ( $ locale ) { if ( is_null ( $ charset ) ) { throw new InvalidArgumentException ( '$charset argument must not be null' ) ; } $ first = self :: substr ( $ string , 0 , 1 , $ charset ) ; if ( self :: isAlpha ( $ first , $ charset ) ) { $ string = self :: upper ( $ first , true , $ charset ) . self :: substr ( $ string , 1 , null , $ charset ) ; } } else { $ string = self :: upper ( substr ( $ string , 0 , 1 ) , false ) . substr ( $ string , 1 ) ; } return $ string ; }
Returns a string with the first letter capitalized if it is
alphabetic.

@param string $string   The string to be capitalized.
@param boolean $locale  If true the string will be converted based on a
given charset, locale independent else.
@param string $charset  The charset to use, defaults to current charset.

@return string  The capitalized string.
Returns a string with the first letter capitalized if it is alphabetic .