fork download
  1. <?php
  2. $data = <<<__EOF
  3. "1","
  4. Data1
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. ","
  15. Data2
  16. ","
  17. Data3
  18. ","-","-1","-","-","-","-"
  19. __EOF;
  20.  
  21. $data = explode(',', preg_replace(
  22. array('/\r\n|\r|\n/', '/"\s*(\S*?)\s*"/'),
  23. array('' , '$1' ),
  24. $data
  25. ));
  26.  
  27. print_r($data);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [1] => Data1
    [2] => Data2
    [3] => Data3
    [4] => -
    [5] => -1
    [6] => -
    [7] => -
    [8] => -
    [9] => -
)