【发布时间】:2015-08-28 02:16:47
【问题描述】:
我正在尝试使每个句子的第一个字母大写,同时保留标点符号。我试过 ucfirst,但它只使字符串的第一个字母大写,而不是所有其他句子。我该如何解决这个问题?
$text = "yes. are you listening to me? huh?!"
$text = ucfirst($text);
echo $text;
预期输出:
Yes. Are you listening to me? Huh?!"
实际输出:
Yes. are you listening to me? huh?!"
【问题讨论】:
-
这个功能的手册页有几个用户功能可以做到这一点
-
那本手册确实是个好地方
标签: php string uppercase ucfirst