0

こんにちは、この「動的」セパレーターに基づいて、文字列を配列に分割する必要があります。

String   1  String2

String2   65  String3

それの変数の間の数  ...また、文字列にも含まれている可能性が あるため、str_replaceまたは爆発は役に立たない(私にとって)

4

1 に答える 1

0
$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 «Â  »
于 2011-08-19T07:48:07.460 に答える