3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $htmlWithScript = "<html><body><div>something></div><script type=\"text/javascript\"> var showShareBarUI_params_e81 = { buttonWithCountTemplate: '<div class=\"sBtnWrap\"><a href=\"#\" onclick=\"\$onClick\"><div class=\"sBtn\">\$text<img src=\"\$iconImg\" /></div><div class=\"sCountBox\">\$count</div></a></div>', } </script></body></html>"; $htmlWithoutScript = preg_replace_callback('~<script.*>.*~Uim', function($matches){ var_dump($matches);exit; return ''; }, $htmlWithScript); echo "nic"; var_dump($htmlWithoutScript);
based on hjggD
Output for 5.6.0 - 7.3.0alpha1
array(1) { [0]=> string(31) "<script type="text/javascript">" }