fork(1) download
  1. <?php
  2.  
  3. $s = <<<MOOEOS
  4. <p>Lorem ipsum</p>
  5. Dolor sit amet
  6. <br><br>
  7. consectetur
  8. <p>adipiscing</p>
  9. <br>elit.
  10. MOOEOS;
  11.  
  12. var_dump(preg_split('/(<\s*p\s*\/?>)|(<\s*br\s*\/?>)/', $s));
Success #stdin #stdout 0.01s 13112KB
stdin
Standard input is empty
stdout
array(6) {
  [0]=>
  string(0) ""
  [1]=>
  string(31) "Lorem ipsum</p>
Dolor sit amet
"
  [2]=>
  string(0) ""
  [3]=>
  string(13) "
consectetur
"
  [4]=>
  string(15) "adipiscing</p>
"
  [5]=>
  string(5) "elit."
}