Given 是一个带有两个不同分隔符的字符串:
$string = '123|foo,456|bar,789|bla';
结果应该是一个数组:
array
(
[123] => 'foo'
[456] => 'bar'
[789] => 'bla'
)
或者:
array
(
[0] => array
(
[id] => 123
[value] => 'foo'
)
[1] => array
(
[id] => 456
[value] => 'bar'
)
[2] => array
(
[id] => 789
[value] => 'bla'
)
)
爆炸字符串并将其带入数组的最聪明的方法是什么?