php中可以通过
ucfirst
函数将一个字符串中的第一个字母转换成大写,而ucwords
函数可以将一个字符串中每个单词的首字母转换成大写。
示例
<?php
$string = "wjssk,when i think of you.";
$sentence = ucfirst($string);
$title = ucwords($string);
print("$sentence\n");
print("$title\n");
print("\n");
?>
输出
Wjssk,when i think of you.
Wjssk,When I Think Of You.
评论 (0)