3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $valid_strings = array("<p>","&nbsp;","</p>"); $test1 = "<p>asdasdasdasdasdasdasd</p>"; $test2 = "<p>&nbsp;&nbsp;&nbsp;&nbsp;</p>"; echo ContainsAnythingElseThan($test1,$valid_strings); echo ContainsAnythingElseThan($test2,$valid_strings); function ContainsAnythingElseThan($the_string,$the_valid_strings_array) { echo "<br>".str_replace($the_valid_strings_array,"",$the_string); }
based on DLMea
Output for 4.3.0 - 7.1.0
<br>asdasdasdasdasdasdasd<br>