【发布时间】:2010-09-12 04:19:19
【问题描述】:
我有以下输入:
几句话 - 25 还有一些 - 话 - 7 另一个 - 一组 - 单词 - 13
我需要拆分成这个:
[0] = "a few words"
[1] = 25
[0] = "some more - words"
[1] = 7
[0] = "another - set of - words"
[1] = 13
我正在尝试使用 preg_split 但我总是错过结束数字,我的尝试:
$item = preg_split("#\s-\s(\d{1,2})$#", $item->title);
【问题讨论】:
标签: php regex preg-split