fork download
  1. <?php
  2.  
  3. $string = '[c]str1[/c][c]str2[/c][c]str3[/c][c]str4[/c][c]str5[/c]';//
  4. $strarray = preg_split('/\[.](.*?)\[\/.]/', $string, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
  5. print_r($strarray);
  6.  
  7.  
Success #stdin #stdout 0.02s 24192KB
stdin
Standard input is empty
stdout
Array
(
    [0] => str1
    [1] => str2
    [2] => str3
    [3] => str4
    [4] => str5
)