我有一个示例代码:
$string = 'abc def ghi abc des abc xyz';
$arr = explode('abc', $string);
print_r(arr);
结果是
Array (
[0] =>
[1] => def ghi
[2] => des
[3] => xyz
)
但我想在结果段中保留“abc”,如下所示:
Array (
[0] =>
[1] => abc def ghi
[2] => abc des
[3] => abc xyz
)
如何解决?