Let's say I have two arrays...
$radicand_array = array(3, 5, 5, 2);
$coeff_array = array(-10, 14, 3, -6);
I'd like to be able to determine which (if any) values in $radicand_array
match, AND also know what the keys are. So, in this case I would want to know that there's a match on keys 1 and 2 of $radicand_array
.
I need to know this because I want to then add the corresponding key values in $coeff_array
. So, in this case I would then add 14 and 3 based on the matching 5's in $radicand_array
.
I've tried array_count_values()
, but it doesn't seem to give the key values like I want. Is there a PHP function ready made for this?