PHP-如何打印段落中的几个单词
在我的代码中,我有:
$row = "Some text in my string";
现在我正在使用 php 并在该变量中打印一些单词。
例如:我想要 2 个单词:输出将是:“Some text”; (等3个词,4个词)
但我不知道如何在php中做到这一点!
In my code, i have:
$row = "Some text in my string";
now i'm using php and print some word in that variable.
for example: i want 2 words: output will be: "Some text"; (etc with 3 words, 4 words)
but i don't know how to do that in php !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个
Try this
输出:
Outputs:
自己动手吧,你将学到 PHP 的一些
技巧:
explode
array_slice
内爆
Do it yourself, you will learn some part of PHP
Tips:
explode
array_slice
implode