每个字符后换行
如果我想在每个字符后创建一个新的换行符,什么 PHP 代码最容易使用。 假设我有这个字符串“hello world!”。现在我不想做的就是让它看起来像这样:
小时
e
l
l
o
w
o
r
l
日
!
我应该使用什么样的代码。我现在只有换行代码,而不是字符之间的空格代码。提前致谢!
What PHP code would be easiest to use if I want to create a new linebreak after each character.
Lets say that I have this string "hello world!". Now what I wan't to do is to make it look like this:
h
e
l
l
o
w
o
r
l
d
!
What kind of a code should I use. I only now the linebreak codes and not a code for space between the characters. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以在此处查找 chr 的值: http://www.asciitable.com/
对于换行符你可以只添加“\n”而不是 chr(...)
You can lookup the value for chr here: http://www.asciitable.com/
For linebreak(s) you can just add "\n" instead of chr(...)
如果输出为 HTML,只需在每个字符后添加一个分隔符即可。
If the output shall be HTML simply add a break after each character.