I'm newbie php programmer.
i serious problem T_T....
use php preg_match_all with regex,
$pattern = "/<<>>(.*){0,20}?(<<>>)/";
$text = <<>>id1<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>>";
$text.= "<<>>id2<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>>";
$text.= "<<>>id3<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>>";preg_match_all($pattern, $text, $match);
this result.
Array (
[0] => Array ([0] => <<>>id1<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>><<>>id2<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>><<>>id3<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>> )
[1] => Array ( [0] => id1<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>><<>>id2<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21<<>><<>>id3<<>>2<<>>3<<>>4<<>>5<<>>6<<>>7<<>>8<>>9<<>>10<<>>11<<>>12<<>>13<<>>14<<>>15<<>>16<<>>17<<>>18<<>>19<<>>20<<>>21 )
[2] => Array ( [0] => <<>> )
)
however, i want result, below.
[0] => (
[0] => id1
[1] => 1
[2] => 2
...
)[1] => (
[0] => id2
[1] => 1
[2] => 2
...
)
how do regex pattern, this result?
Edit1.
array_filter(preg_split('/>/', $text));
Array ( [1] => id1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 [10] => 10 [11] => 11 [12] => 12 [13] => 13 [14] => 14 [15] => 15 [16] => 16 [17] => 17 [18] => 18 [19] => 19 [20] => 20 [21] => 21 [23] => id2 [24] => 2 [25] => 3 [26] => 4 [27] => 5 [28] => 6 [29] => 7 [30] => 8 [31] => 9 [32] => 10 [33] => 11 [34] => 12 [35] => 13 [36] => 14 [37] => 15 [38] => 16 [39] => 17 [40] => 18 [41] => 19 [42] => 20 [43] => 21 [45] => id3 [46] => 2 [47] => 3 [48] => 4 [49] => 5 [50] => 6 [51] => 7 [52] => 8 [53] => 9 [54] => 10 [55] => 11 [56] => 12 [57] => 13 [58] => 14 [59] => 15 [60] => 16 [61] => 17 [62] => 18 [63] => 19 [64] => 20 [65] => 21 )
but, i want
[0] => ([0] =>id1 [1]=> 1 ...)
[1] => ([0] =>id2 [1]=> 1 ...)
[2] => ([0] =>id3 [1]=> 1 ...)
how do this?