3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "<h3>hello</h3>this is my test and <h3><span>bye</span></h3>"; $arr = preg_split('/(<h3>.*?<\/h3>)/', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); print_r($arr);

preferences:
18.29 ms | 402 KiB | 5 Q