3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt = <<<TXT First chunk doesn't start with any delimiter. ****** Second chunk is separated from the first one by six asterisks plus a carriage return. ****** Third chunk is separated from the second one by six asterisks plus a carriage return. ****** And son on... and on. ****** But we might find other asterisks, maybe six like ****** inside the paragraph, and those one are not to be split. Same for new lines without ****** which should stay the same. TXT; var_export( preg_split('/\R*^\*{6}$\R*/m', $txt, 0, PREG_SPLIT_NO_EMPTY) );

preferences:
25.62 ms | 405 KiB | 5 Q