fork download
  1. <?php
  2.  
  3. $s = "twoX // threeY";
  4. print_r(preg_split('~\s*(/{2,3})\s*~', $s, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
Success #stdin #stdout 0.02s 82944KB
stdin
Standard input is empty
stdout
Array
(
    [0] => twoX
    [1] => //
    [2] => threeY
)