, preg_split(), preg_replace(), (Demo)
$in='"Chess helps us overcome difficulties and sufferings," said Unnikrishnan, taking my queen. "On a chess board you are fighting. as we are also fighting the hardships in our daily life." he said.';
$out=preg_split('/ (?=")/',$in,null,PREG_SPLIT_NO_EMPTY);
$find='/[""]/u';
$replace='"';
$out=preg_replace($find,$replace,$out);
var_export($out);
:
array (
0 => '"Chess helps us overcome difficulties and sufferings," said Unnikrishnan, taking my queen.',
1 => '"On a chess board you are fighting. as we are also fighting the hardships in our daily life." he said.',
)
preg_split() , " (LEFT DOUBLE QUOTE).
preg_replace() u, , . '/"|"/' , u, , ( 189 372 ).
preg_split() preg_match_all(), preg_split() , , left double quote. preg_match_all() , , , .
, preg_match_all(), preg_split() :
$out=preg_match_all('/".+?(?= "|$)/',$in,$out)?$out[0]:null;