fork(1) download
  1. <?php
  2.  
  3. $string = "letters1234_1-someMoreText";
  4. $string_split = $string;
  5. if (preg_match('/^([A-Z]+[0-9]+)_([0-9])-(.*)/si', $string, $matches)) {
  6. array_shift($matches);
  7. $string_split = $matches;
  8. }
  9. print_r($string_split);
Success #stdin #stdout 0.02s 24012KB
stdin
Standard input is empty
stdout
Array
(
    [0] => letters1234
    [1] => 1
    [2] => someMoreText
)