下面小结php中的几个字符函数,小结一下:
1)ucfirst
将首字母变大写,比如
$string = "this is my web development blog";
echo ucfirst($string);
// output: this is my web development blog
2) lcfirst,将首字母变小写
$string = "this is my web development blog";
echo lcfirst($string);
// output: this is my web development blog
3)strtoupper,将整个字符串变大写
$string = "this is my web development blog";
echo strtoupper($string);
// output: this is my web development blog
4) strtoplower,将整个字符串变小写
$string = "this is my web development blog";
echo strtolower($string);
// output: this is my web development blog
5)ucwords(),可以将句子中每个单词的第一个字母变大写,比如
$string = "this is my web development blog";
echo ucwords($string);
// output: this is my web development blog
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号