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

$original_string_2 = 'heLLO';
$ucwords_string_2 = ucwords($original_string_2);
echo $ucwords_string_2; // 출력: 'HeLLO'
ucwords(string $string, string $separators = " \t\r\n\f\v"): string
$text = "apple|banana|cherry";
echo ucwords($text, "|"); 
// 출력: Apple|Banana|Cherry
$utf8_string = 'äpfel und birnen'; 
echo ucwords($utf8_string); // 예상과 다른 결과
// 출력: äpfel Und Birnen
$text = 'hello, world!';
ucwords($text);
echo $text; // 출력: 'hello, world!' (원본 문자열은 변경되지 않음)

$text = ucwords($text);
echo $text; // 출력: 'Hello, World!'