Code: Select all
<?php
$html_array = array();
$pattern = '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/';
$html_string = '<html><body><p class="a<weird>name">The classname is not seen as a different tag</p></body></html>';
$html_array = preg_split ($pattern, trim ($html_string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
print_r($html_array);
?>Code: Select all
Array ( [0] => [1] => [2] =>
[3] => The classname is not seen as a different tag [4] =>
[5] => [6] => )Thank you in advance.
Rgrds, maddox