PHP英文字母大小写转换函数小结
发布时间:2020-12-12 20:10:01 所属栏目:PHP教程 来源:网络整理
导读:每个单词的首字母转换为大写:ucwords() 代码如下: $foo = 'hello world!'; $foo = ucwords($foo); // Hello World! $bar = 'HELLO WORLD!'; $bar = ucwords($bar); // HELLO WORLD! $bar = ucwords(strtolower($bar)); // Hello World! ?> 第一个单词首字母
每个单词的首字母转换为大写:ucwords() 代码如下: $foo = 'hello world!';
$foo = ucwords($foo); // Hello World! $bar = 'HELLO WORLD!'; 第一个单词首字母变大写:ucfirst() 代码如下: $foo = 'hello world!';
$foo = ucfirst($foo); // Hello world! $bar = 'HELLO WORLD!'; 第一个单词首字母变小写:lcfirst() 代码如下: $foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld $bar = 'HELLO WORLD!'; 所有字母变大写:strtoupper() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |