Then do the same for the blockquote, for crying out loud. That's what I meant by "flexible".
Edit: This is what I mean by "flexible":
function get_enclosed_text($str, $open, $close)
{
$str = str_replace(array(strtoupper($open), strtoupper($close)),
array(strtolower($open), strtolower($close)), $str);
$arr = explode($open, $str);
foreach ($arr as $substr) {
if (($pos = strpos($substr, $close)) !== false) {
$text[] = substr($substr, 0, $pos);
}
}
return $text;
}
Example
$quote_strs = get_enclosed_text($str, '<blockquote>', '</blockquote>');
foreach ($quote_strs as $key => $val) {
$sub_txt[$key][] = get_enclosed_text($val, '<p>', '</p');
}
print_r($sub_txt);