PHP 버전
4+
$original_string_1 = 'hello, world!';
$ucfirst_string_1 = ucfirst($original_string_1);
echo $ucfirst_string_1; // 출력: 'Hello, world!'

$original_string_2 = 'heLLO';
$ucfirst_string_2 = ucfirst($original_string_2);
echo $ucfirst_string_2; // 출력: 'HeLLO'
ucfirst(string $string): string
// 1. 외부 입력 또는 URL 경로에서 소문자 문자열을 받습니다.
$path = 'user';

// 2. 네임스페이스를 정의합니다. (클래스가 위치한 경로)
$namespace = 'App\\Controllers\\';

// 3. ucfirst()를 사용하여 소문자 경로를 클래스명 표준(대문자 시작)에 맞춥니다.
$class_segment = ucfirst($path); // 'User'

// 4. 네임스페이스, 변환된 클래스명, 접미사를 결합하여 최종 클래스명을 완성합니다.
$full_class = $namespace . $class_segment . 'Controller';

echo "최종 클래스명: " . $full_class . "\n"; 
// 출력: 'App\Controllers\UserController'
$report_title = 'monthly sales';
$formatted_title = ucfirst($report_title); // 첫 글자를 대문자로 변환
echo $formatted_title; // Monthly sales
$text = 'hello';
ucfirst($text);
echo $text; // 출력: 'hello' (변경되지 않음)

$text = ucfirst($text);
echo $text; // 출력: 'Hello'