3v4l.org

run code in 200+ 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 7.2.0
Warning: count(): Parameter must be an array or an object that implements Countable in /in/LFm8R on line 18 1 Warning: count(): Parameter must be an array or an object that implements Countable in /in/LFm8R on line 18 1
Output for 4.3.0 - 7.1.10
11