3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function CountRepeats_nonletters($first_input, $second_input) { $phrase_array = str_split($second_input); $cleanse = array("!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "=", "\\", "|", "}", "]", "[", "{", "'", '"', "?", "/", ".", ">", ",", "<"); $non_alpha_num = !empty(array_intersect($cleanse, $phrase_array)); $cleanse_length = count($cleanse); $phrase_length = count($phrase_array); if($non_alpha_num){ for($x=0;$x<27;$x++){ for($z=0;$z<$phrase_length-2;$z++) if($phrase_array[$z] == $cleanse[$x]){ $match = array_search($cleanse[$x], $phrase_array); array_splice($phrase_array, $match, 1); } } } $cleanse_phrase = implode("", $phrase_array); $phrase_array = explode(" ", strtolower($cleanse_phrase)); $search_value = array_keys($phrase_array, strtolower($first_input)); return count($search_value); }
based on NAV7N
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0beta1