【发布时间】:2011-05-10 20:29:36
【问题描述】:
必须有一种快速有效的方法来在针的“第 n 个”出现处拆分(文本)字符串,但我找不到它。 strpos comments in the PHP manual 中有相当完整的功能集,但这似乎有点满足我的需要。
我的纯文本为$string,并希望在$needle 的nth 次出现时将其拆分,在我的情况下,needle 只是一个空格。 (我可以进行完整性检查!)
我该怎么做?
【问题讨论】:
-
这里的“针”是什么意思?
-
@PeterMortensen php.net/manual/en/function.strpos.php#102336 你在找什么。来自表达式:Searching for a needle in a haystack