php ucwords函数用于把每个单词的首字符转换为大写,并返回已转换的字符串;语法为“ucwords(string)”,参数string用于指定要转换的字符串。
php ucwords
作用:把每个单词的首字符转换为大写
语法:
ucwords(string)
参数:
立即学习“PHP免费学习笔记(深入)”;
string 必须,规定要转换的字符串
说明:把字符串中每个单词的首字符转换为大写,该函数是二进制安全的。
php ucwords()函数使用示例1:
<?php $i = "hello world"; $j = ucwords($i); echo $j; ?>
输出:
Hello World
php ucwords()函数使用示例2:
<?php $i = "I'm study in php.cn"; $j = ucwords($i); echo $j; ?>
输出:
I'm Study In Php.cn
以上就是php ucwords函数怎么用的详细内容,更多请关注php中文网其它相关文章!
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号