3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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>'; $_content = preg_replace('#(?:<(div|span)[^>]*>[\s]*)*(?P<content><iframe[\s]*([^>]+)>[\s]*<\/iframe[^>]*>)(?:[\s]*<(embed|script)[^>]*>[^<]*<\/(embed|script)[^>]*>[\s]*)*(?:<\/(?:div|span)[^>]*>)*#iu', '', $_content); var_dump($matches);
based on YhJP1
Output for 5.0.4 - 7.1.0
Notice: Undefined variable: matches in /in/AJQLG on line 4 NULL
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: matches in /in/AJQLG on line 4 NULL