您好,欢迎访问一九零五行业门户网

PHP转换大小写教程基础

为了照顾刚初学php的朋友们,本章内容就和大家分享一下最基础的知识:php如何转换大小写,我们会用示例来进行讲解。
strtoupper()
所有字母变大写
strtolower()
所有字母变小写
ucwords()
每个单词的首字母转换为大写
ucfirst()
第一个单词首字母变大写
lcfirst()
第一个单词首字母变小写
示例:
$foo = 'hello world!'; $foo = ucwords($foo); // hello world! $bar = 'hello world!'; $bar = ucwords($bar); // hello world! $bar = ucwords(strtolower($bar)); // hello world! $foo = 'hello world!'; $foo = ucfirst($foo); // hello world! $bar = 'hello world!'; $bar = ucfirst($bar); // hello world! $bar = ucfirst(strtolower($bar)); // hello world! $foo = 'helloworld'; $foo = lcfirst($foo); // helloworld $bar = 'hello world!'; $bar = lcfirst($bar); // hello world! $bar = lcfirst(strtoupper($bar)); // hello world!
以上内容就是php转换大小写的详解,希望网对大家有帮助。
相关推荐:
python中转换大小写的方法
php字符串首字母转换大小写实例_php教程
php字符串首字母转换大小写
以上就是php转换大小写教程基础的详细内容。
其它类似信息

推荐信息