- preg_match_all: documentation ( source)
- var_export: documentation ( source)
<?php
$html = <<<HTML
<p>She was like: "
<i data-note="Oh, dear this may go haywire">I can't believe it! <img src='crookedface.gif'><br>
Watch this video <iframe src="somwhere"></iframe><br>
Are you getting all of this?</i>
</p>
HTML;
$el = 'i';
var_export(preg_match_all('/(<'.$el.'(.*?)>)((\n*?.*?\n*?)<\/'.$el.'>|)/', $html, $out, PREG_SET_ORDER) ? $out : []);