PHP 字符串大小寫轉(zhuǎn)換幾個相關(guān)函數(shù)
假設(shè)字符串是:$str = "this Is hello world";
1、全部轉(zhuǎn)小寫
echo ucfirst($str);
3、每個單詞首字母大寫
echo ucwords($str);
4、整個字符串全部變大寫
echo strtoupper($str);
注意:PHP5.3 以后, 支持lcfirst($str); //第一個字母轉(zhuǎn)小寫
1、全部轉(zhuǎn)小寫
echo strtolower($str);
2、第一個字母轉(zhuǎn)大寫echo ucfirst($str);
3、每個單詞首字母大寫
echo ucwords($str);
4、整個字符串全部變大寫
echo strtoupper($str);
注意:PHP5.3 以后, 支持lcfirst($str); //第一個字母轉(zhuǎn)小寫
中國· 上海

添加微信咨詢
關(guān)鍵詞
辦公室:上海市浦東新區(qū)郭守敬路351號
CopyRight?2009-2019 上海谷谷網(wǎng)絡(luò)科技有限公司 All Rights Reserved. 滬ICP備11022482號-8
- top
- 在線咨詢
-
添加微信咨詢