PHP為我們提供了字符串中大小寫字母轉換的函數,
strtoupper()將指定的字符全部轉換為大寫;
strtolower()將北定的字符都轉換成小寫;
ucwords()將指定字符串中每個單詞的首字母都轉成大寫;
ucfirst()函數將指定字符串的首字母轉換為大寫。
其語法結構都是一樣的,在括號中填入指定的字符串即可。
<?php $a='i am A student.'; echo strtoupper($a)."<br>"; // I AM A STUDENT. echo strtolower($a)."<br>"; // i am a student. echo ucfirst($a)."<br>"; // I am A student. echo ucwords($a)."<br>"; // I Am A Student. ?>
來自匯智網
