欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

每個(gè)單詞的首字母轉(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! 
?> 

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

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

第一個(gè)單詞首字母變小寫: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)換的實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論