使用PHP将用户名称设置为大写

I have a welcome message for logged in users;

<?php
echo "<h1>Welcome, {$_SERVER['PHP_AUTH_USER']}.</h1>";
?>

But it would say something like "Welcome, john smith" rather than "Welcome, John Smith"

I've tried using;

<php?
echo ucfirst
?>

But that doesn't work because of how PHP_AUTH_USER is formatted.

Thanks in advance.

Got it

<?php
echo ucwords ("<h1>Welcome, {$_SERVER['PHP_AUTH_USER']}.</h1>");
?>

Just needed to add brackets.

PHP have function called ucwords(). The ucwords() function converts the first character of each word in a string to uppercase.

echo ucwords("<h1>Welcome, {$_SERVER['PHP_AUTH_USER']}.</h1>");