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) { $nothing = array(""); echo count(str_replace($the_valid_strings_array,$nothing,$the_string)); }
based on NEfEV
Output for 4.3.0 - 7.1.0
11