You need to capitalize, lowercase, or otherwise modify the case of letters in a string.
Use ucfirst() or ucwords() to capitalize the first letter of one or more words.
Use strtolower() or strtoupper() to modify the case of entire strings.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"> <head> <title>PHP</title> <meta Name="Author" Content="Hann So"> </head> <body> <p> <?php $username = 'john doe is anonymous'; echo ucfirst($username), "<br />"; echo ucwords($username), "<br />"; echo strtolower($username), "<br />"; echo strtoupper($username), "<br />"; ?> </p> </body> </html> |