PHP 中的大小写字母转换函数 首字母变大写:ucwords()<?php
$foo='helloworld!';
$foo=ucwords($foo);//HelloWorld!
$bar='HELLOWORLD!';
$bar=ucwords($bar);//HELLOWORLD!
$bar=ucwords(strtolower($bar));//HelloWorld!
?>
第一个词首字母变大写:ucfirst()<?php
$foo='helloworld!';
$foo=ucfirst($foo);//Helloworld!
$bar='HELLOWORLD!';
$bar=ucfirst($bar);//HELLOWORLD!
$bar=ucfirst(strtolower($bar));//Helloworld!
?>
第一个词首字母小写lcfirst()<?php
$foo='HelloWorld';
$foo=lcfirst($foo);//helloWorld
$bar='HELLOWORLD!';
$bar=lcfirst($bar);//hELLOWORLD!
$bar=lcfirst(strtoupper($bar));//hELLOWORLD!
?>
字母变大写:strtoupper()
字母变小写:strtolower()