- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$_content = '<div><div><iframe width="1280" height="720" src="//www.youtube.com/embed/NKvxWMsGW9E?rel=0" frameborder="0" allowfullscreen></iframe></div></div><div>this div is ok</div>';
preg_match('#(?:<(?:div|span)[^>]*>[\s]*)*(<iframe[\s]*([^>]+)>[\s]*<\/iframe[^>]*>)(?:[\s]*<(?:embed|script)[^>]*>[^<]*<\/(?:embed|script)[^>]*>[\s]*)*(?:<\/(?:div|span)[^>]*>)*#iu', $_content, $matches);
//echo $_content;
var_dump($matches);