OrganizedChaos
MIS
I have 2 arrays build with numbers in both, I want to compare the numbers from both group and only print the unique numbers from the second group.
So, for example
array1[0]=1
array1[1]=2
array1[2]=3
array1[3]=4
array2[0]=5
array2[1]=4
array2[2]=3
array2[3]=2
array2[4]=1
So in this example, I would like it to display 5 or array2[0]
I was trying a couple of nested loops, but I cant seem to get it.
for example:
Help please
So, for example
array1[0]=1
array1[1]=2
array1[2]=3
array1[3]=4
array2[0]=5
array2[1]=4
array2[2]=3
array2[3]=2
array2[4]=1
So in this example, I would like it to display 5 or array2[0]
I was trying a couple of nested loops, but I cant seem to get it.
for example:
Code:
$i=0;
while ($i < 5) {
$a=0;
while ($a < 4){
if ($array2[$i] == $array1[$a]){
$i++;
}
$a++;
}
print array2[$i];
$i++;
}
Help please