亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

PHP將字符串首字母大小寫轉(zhuǎn)換的實例

 更新時間:2017年01月21日 08:54:42   投稿:jingxian  
下面小編就為大家?guī)硪黄狿HP將字符串首字母大小寫轉(zhuǎn)換的實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

每個單詞的首字母轉(zhuǎn)換為大寫:ucwords()

<?php 
$foo = 'hello world!'; 
$foo = ucwords($foo);       // Hello World! 
 
$bar = 'HELLO WORLD!'; 
$bar = ucwords($bar);       // HELLO WORLD! 
$bar = ucwords(strtolower($bar)); // Hello World! 
?> 

第一個單詞首字母變大寫:ucfirst()

<?php 
$foo = 'hello world!'; 
$foo = ucfirst($foo);       // Hello world! 
 
$bar = 'HELLO WORLD!'; 
$bar = ucfirst($bar);       // HELLO WORLD! 
$bar = ucfirst(strtolower($bar)); // Hello world! 
?> 

第一個單詞首字母變小寫:lcfirst()

<?php 
$foo = 'HelloWorld'; 
$foo = lcfirst($foo);       // helloWorld 
 
$bar = 'HELLO WORLD!'; 
$bar = lcfirst($bar);       // hELLO WORLD! 
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD! 
?> 

所有 字母變大寫:strtoupper()

所有 字母變小寫:strtolower()

以上這篇PHP將字符串首字母大小寫轉(zhuǎn)換的實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論