- 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);
var_dump($matches);