strtoupper()函數
strtoupper()函數可以將字符串作為參數,然后把字符串全部轉換為大寫,并返回。
基本語法:
strtoupper(string)
示例:
?php function toUpper($string){ return(strtoupper($string)); $string= Hello world! echo (toUpper($string)); ?
輸出:
strtolower()函數
strtolower()函數可以將字符串作為參數,然后把字符串全部轉換為小寫,并返回。
基本語法:
strtolower(string)
示例:
?php function toUpper($string){ return(strtolower($string)); $string= JAVASCRIPT echo (toUpper($string)); ?
輸出:
ucfirst()函數
ucfirst()函數可以將字符串作為參數,然后把字符串的首字母轉換為大寫,其他字符不變,并返回。
基本語法:
ucfirst(string)
示例:
?php function toUpper($string){ return(ucfirst($string)); $string= hello world! echo (toUpper($string)); ?
輸出:
lcfirst() 函數
lcfirst()函數可以將字符串作為參數,然后把字符串的首字母轉換為小寫,其他字符不變,并返回。
基本語法:
lcfirst(string)
示例:
?php function toUpper($string){ return(lcfirst($string)); $string= PHP ! echo (toUpper($string)); ?
輸出:
以上就是本篇文章的全部內容,希望能對大家的學習有所幫助。更多精彩內容大家可以關注php 相關教程欄目?。?!
以上就是PHP如何對字符串進行大小寫處理的詳細內容,PHP教程
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。
新聞熱點
疑難解答