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

PHP英文字母大小寫(xiě)轉(zhuǎn)換函數(shù)小結(jié)

 更新時(shí)間:2014年05月03日 08:24:18   作者:  
這篇文章主要介紹了幾個(gè)PHP英文字母大小寫(xiě)轉(zhuǎn)換函數(shù),分為首字母大小寫(xiě)轉(zhuǎn)換和所有字母大小寫(xiě)轉(zhuǎn)換,需要的朋友可以參考下

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

復(fù)制代碼 代碼如下:
<?php
$foo = 'hello world!';
$foo = ucwords($foo);             // Hello World!

$bar = 'HELLO WORLD!';
$bar = ucwords($bar);             // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!
?>

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

復(fù)制代碼 代碼如下:
<?php
$foo = 'hello world!';
$foo = ucfirst($foo);             // Hello world!

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

第一個(gè)單詞首字母變小寫(xiě):lcfirst()

復(fù)制代碼 代碼如下:
<?php
$foo = 'HelloWorld';
$foo = lcfirst($foo);             // helloWorld

$bar = 'HELLO WORLD!';
$bar = lcfirst($bar);             // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>

所有字母變大寫(xiě):strtoupper()
所有字母變小寫(xiě):strtolower()

相關(guān)文章

最新評(píng)論