fork download
  1. <?php
  2.  
  3. $re = "/(?<=[0-9])(-)(?=[0-9])/";
  4. $str = "sometext9-9sometext";
  5. $a = preg_split($re, $str, $matches, PREG_SPLIT_DELIM_CAPTURE);
  6. print_r($a);
Success #stdin #stdout #stderr 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => sometext9
    [1] => -
    [2] => 9sometext
)
stderr
PHP Notice:  Undefined variable: matches in /home/J6kJ8S/prog.php on line 5