【发布时间】:2015-06-05 16:15:26
【问题描述】:
我有以下段落:
This is the first line.
this is the second line.
we live in Europe.
this is the fourth line.
我想在每个换行符中将第一个字符转换为 uppercase。
所以段落应该是这样的:
This is the first line.
This is the second line.
We live in Europe.
This is the fourth line.
到目前为止,我能够将第一个字符转换为大写,但它使用ucfirst() 和ucword() 将每个单词中的第一个字符转换为换行符而不是换行符
echo ucfirst($str);
有没有办法使用ucfirst() 或preg_replace() 函数来解决这个问题?
谢谢!
【问题讨论】:
-
这些段落是如何生成的?您可以在 CSS 而不是 PHP 中执行此操作。
标签: php