嗨,我需要根据这个"动态"分隔符将一个字符串分割成一个数组:
String  1 String2
String2 Â 65Â String3
数字之间的Â
它的变量…字符串也可以包含Â
,所以一个str_replace或一个爆炸它是无用的(对我来说)
$str = "String  1  ";
$result = preg_split('/ Â [d]+Â /', $str);
print_r($result);
Array
(
[0] => String
[1] => Â
)
解释:
# Match the characters “ Â ” literally « Â »
# Match a single digit 0..9 «[d]+»
# Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
# Match the characters “Â ” literally «Â »