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

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

 更新時間:2014年05月03日 08:24:18   作者:  
這篇文章主要介紹了幾個PHP英文字母大小寫轉(zhuǎn)換函數(shù),分為首字母大小寫轉(zhuǎn)換和所有字母大小寫轉(zhuǎ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()

相關(guān)文章

最新評論