<?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);
Array
(
[0] => <h3>hello</h3>
[1] => this is my test and
[2] => <h3><span>bye</span></h3>
)
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
[0] => <h3>hello</h3>
[1] => this is my test and
[2] => <h3><span>bye</span></h3>
)