- var_dump: documentation ( source)
- preg_split: documentation ( source)
<?php
$data = [
'',
'nothing here',
'something<snip>here',
false,
0,
null,
];
foreach( $data as $text ) {
$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
var_dump($textarr);
}