I am not sure about this assignment line $temp[$i. ','.$key] = $temp[$i]; ?
I think it is supposed to reset the index?
I can't use array_unique, array_diff or array_find or array_filter functions because the problem is to remove what is in strB from strA, including dupes, but leave the duplicates and every string that isn't in A. I can't use array_unique to remove the duplicates first and I can't compare the two arrays with array_diff because it won't work with dupes and if I use array_find to find the values in A from B it will only find the first one, correct me if I'm wrong.
I got this test line from the php manual but I don't understand why the searched for value and the $key value is set to equal the temp[$i] before it is unset but all I need to do is remove all the values in $bStr in $aStr. In any case I am getting a syntax error. With the reference to $aStr that variable should have the value of the removed strings but now I have a syntax error.
thanks,
$aStr= array('a','a','b','b','c','d','d','e');
$bStr= array('b','c','d','d','f');
$aInt= array(1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,19);
$bInt= array(1,3,5,7,9,11,13,15,15,17,17,19,19,20,20,21,22,23,24);
echo "<pre>";
print_r($aStr);
echo "</pre>";
echo "<pre>";
print_r($bStr);
echo "</pre>";
function new_array($b,&$a){
$temp= array();
foreach ($b as $key=>$val){
$i = array_search($val, $a);
if(!empty($i) ){
$temp[$i. ','.$key] = $temp[$i];
unset($temp[$i]);
}
}
$new=new_array($bStr,$aStr));
echo "<pre>";
print_r($aStr);
echo "</pre>";
thanks,