fork(30) download
  1. <?php
  2.  
  3. $s = 'this.line "should be 3" elements';
  4. preg_match_all('/"[^"]+"|\S+/', $s, $matches);
  5. var_dump($matches);
  6.  
  7. ?>
Success #stdin #stdout 0s 13112KB
stdin
Standard input is empty
stdout
array(1) {
  [0]=>
  array(3) {
    [0]=>
    string(9) "this.line"
    [1]=>
    string(13) ""should be 3""
    [2]=>
    string(8) "elements"
  }
}