fork download
  1. <?php
  2.  
  3. $string = "FORT/310117/200826/12979898000170";
  4. preg_match_all("/(?<d6>\b\d{6}\b)|(?<d14>\b\d{14}\b)/", $string, $matches);
  5.  
  6. $d6 = preg_grep('/.{1,}/', $matches['d6']);
  7. $d14 = preg_grep('/.{1,}/', $matches['d14']);
  8.  
  9. if($d6 && $d14){
  10.  
  11. $d6_1 = $d6[0];
  12. $d6_2 = $d6[1];
  13. $d14 = implode('', $d14);
  14.  
  15. echo $d6_1 ." / ". $d6_2 . " / ". $d14;
  16.  
  17. }
Success #stdin #stdout 0.01s 82624KB
stdin
Standard input is empty
stdout
310117 / 200826 / 12979898000170