<?php $s = 'this.line "should be 3" elements';preg_match_all('/"[^"]+"|\S+/', $s, $matches);var_dump($matches); ?>
Standard input is empty
array(1) { [0]=> array(3) { [0]=> string(9) "this.line" [1]=> string(13) ""should be 3"" [2]=> string(8) "elements" } }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!