我试图使每个句子的第一个字母大写,同时保留标点符号。我尝试过 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?!"