【发布时间】:2017-08-02 04:59:36
【问题描述】:
我正在尝试使用 PHP 分解字符串,但只有在分解它之前检测到分隔符的第二个实例时,对于我的情况,我想在检测到第二个空格后分解它。
我的字符串
Apple Green Yellow Four Seven Gray
我的愿望输出
Apple Green
Yellow Four
Seven Gray
我的初始代码
$string = 'Apple Green Yellow Four Seven Gray';
$new = explode(' ',$string);
如何使用explode 或PHP 的任何分离方法来实现这一点?提前致谢!
【问题讨论】: