str_replace counts fail to accumulate when passed array(s).

The $count parameter of str_replace is supposed to return the total number of string replacements performed. This was only working correctly when both $search and $subject were strings. When either or both are arrays, the counts need to accumulate across all replacements. The code, as written, was only returning the replacement count for the last pair of values.