每個單詞的首字母轉換為大寫:ucwords()
複製代碼 代碼如下:$foo = 'hello world!';
$foo = ucwords($foo); // Hello World!
$bar = 'HELLO WORLD!';
$bar = ucwords($bar); // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!
?>
第一個單詞首字母變大寫:ucfirst()
複製代碼 代碼如下:$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
第一個單詞首字母變小寫:lcfirst()
複製代碼 代碼如下:$foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld
$bar = 'HELLO WORLD!';
$bar = lcfirst($bar); // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>
所有字母變大寫:strtoupper()
所有字母變小寫:strtolower()
http://www.bkjia.com/PHPjc/764627.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/764627.htmlTechArticle每個單詞的首字母轉換為大寫:ucwords() 複製代碼 代碼如下: ?php $foo = 'hello world!'; $foo = ucwords($foo); // Hello World! $bar = 'HELLO WORLD!'; $bar = ucwor...