字符串ucwords解析

代码如下:

<?php

header("Content-type:text/html;charset=utf-8");

/*

 * 语法结构:ucwords(string)

 * 说明:把字符串中每个单词的首字符转换为大写

 * 参数:string规定要转换的字符串

 * 注意:首字符必须是字母才转换为大写字母

 */

$str = ucwords("hello world!");

var_dump($str);

截图如下:

QQ截图20181017105634.png

运行结果如下:

QQ截图20181017105658.png

QQ截图20181017105756.png

猜你喜欢

转载自blog.51cto.com/suyanzhu/2301032