fork(1) download
  1. <?php
  2.  
  3. $str="a,b,c,d-e,f,g,h";
  4. $ex = array_map(function ($s) {
  5. return explode(",", $s);
  6. }, explode("-", $str));
  7. print_r($ex);
  8.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => a
            [1] => b
            [2] => c
            [3] => d
        )

    [1] => Array
        (
            [0] => e
            [1] => f
            [2] => g
            [3] => h
        )

)