图片加载中...

图片加载中... 十六年IT教育机构

图片加载中... 软件定制开发

首页>新闻动态>Python人工智能+大数据技术文章

PHP大小写转换详解

更新时间:2017-10-17

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去除html标签中strip_tags与htmlspecialchars的区别


下一篇:2018年python成为主流语言的原因是什么?

相关课程MORE>

图片加载中

WEB前端全栈开发就业班

前端开发就是利用各种Web技术进行产品的界面开发...

图片加载中

UI全栈设计就业班

让学生快速达到一名UI界面设计师的标准...

图片加载中

PHP高级架构开发就业班

广阔的发展空间,需要新型的技术人员...

图片加载中

Python大数据分析就业班

高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。...

图片加载中

Linux云计算运维就业班

云服务器是一种简单高效、处理能力可弹性伸缩的计算服务。...

图片加载中TEL:010-83650488

图片加载中