This question already has an answer here:
function teste(){
$string = '<div>Hello, i am João</div><a href="test/test.com">testttttttttttt</a>';
$matches = array();
preg_match('/<[^>]*>/', $string, $matches, PREG_OFFSET_CAPTURE);
print_r($matches);exit();
}
I am having a little problem with Regex, I just want to get the text from everything that is between the html tags (including the tags) and create an array with those results, however, I'm not able to save the result to the array.
Basically, I need the following return:
Array(
[0] => <div>
[1] => </div>
[2] => <a href="test/test.com">
[3] => </a>
)
</div>