$arr_str = preg_split("( ){3}", $r); (Не работает) 

there are lines 10.0.0.1 AA: SS: DD: FF: HH 35 10.0.0.2 AA: TT: GG: BB: CC 36

turn into Array( [0] => 10.0.0.1 [1] => AA:SS:DD:FF:HH [2] => 35 ) Array( [0] => 10.0.0.2 [1] => AA:TT:GG:BB:CC [2] => 36 )

1 answer 1

Why preg_split use explode

 $result = explode(' ', $arr_str); 
  • Then it turns out Array ([0] => 10.0.0.1) Array ([0] => AA: SS: DD: FF: HH) Array ([0] => 35) - Kvandaik
  • you can’t do that [0], since all values ​​will return to 1 array - Dmitriy
  • The pattern for entering a space in other languages ​​is like there is a pattern for 3 spaces and a cutoff - Kvandaik