Böyle bir şey temelde çalışmak:
preg_split('/(<strong>|<b>)/', $html1, 3, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
Sizin testi dize Verilen:
$html1 = '<strong>My content</strong>This is my content.<b>Some more bold</b>content';
Eğer ile bitirmek istiyorum
Array (
[0] => <strong>
[1] => My content</strong>This is my content.
[2] => <b>
[3] => Some more bold</b>content
)
Şimdi, örnek dize güçlü / b ile başlamak olmadıysa:
$html2 = 'like the first, but <strong>My content</strong>This is my content.<b>Some more bold</b>content, has some initial none-tag content';
Array (
[0] => like the first, but
[1] => <strong>
[2] => My content</strong>This is my content.
[3] => <b>
[4] => Some more bold</b>content, has some initial none-tag content
)
element # 0 belirlemek için bir etiket veya metin ise ve basit bir test görmek için nerede "ikinci etiket ve sonrası" metin başlar (element # 3 veya eleman # 4)