<?php $string1 = "abacadeee"; $string2 = "aabbccddee"; $counts2 = count_chars($string2, 1); $tally = 0; foreach (array_intersect_key(count_chars($string1, 1), $counts2) as $charcode1 => $count1) { $tally += min($counts2[$charcode1], $count1); ///echo $charcode1 , ": " , min($counts2[$charcode1], $count1) , "\n"; } echo $tally;
You have javascript disabled. You will not be able to edit any code.