我想要做的是将一个PHP字符串分成一组子字符串,这些子字符串根据开始这些子字符串的“divider”字符分组为数组。字符*
,^
和%
被保留为分隔符。所以,如果我有串"*Here's some text^that is meant*to be separated^based on where%the divider characters^are"
,应该分裂并放置在阵列像这样:根据“divider”字符将PHP字符串划分为排列的子字符串
array(2) {
[0] => "*Here's some text"
[1] => "*to be separated"
}
array(3) {
[0] => "^that is meant"
[1] => "^based on where"
[2] => "^are"
}
array(1) {
[0] => "%the divider characters"
}
我完全失去了在这一个。有谁知道如何实现这一点?
你试过explode()函数吗? – Maximus2012 2015-04-01 19:21:05
“分隔符”的编程术语是分隔符。 – 2015-04-01 19:38:03
感谢您的提示。我不知道。 – vdubguy777 2015-04-01 20:09:52