php ucfirst函数怎么用

2020-07-30 14:51:51
php ucfirst函数用于字符串首字母大写,ucfirst语法是ucfirst(string),参数string是必须的,规定要转换的字符串。

php ucfirst函数怎么用?

作用:字符串首字母大写

语法:

ucfirst(string)

参数:

string必须,规定要转换的字符串。

说明:把字符串中的首字符转换为大写。

php ucfirst()函数使用示例1

<?php$i = "hello world";$j = ucfirst($i);echo $j;?>

输出:

Hello world

php ucfirst()函数使用示例2

<?phpecho ucfirst("hi php.cn");?>

输出:

Hi php.cn
相关文章 大家在看