array and operations with others array
two array
A) 1, 2, 3, 4, 5, 6
B) 4, 6, 9
how can to have an array
C) 4, 6
all the B's values that have value in A
and
an array
D) 1, 2, 3, 4, 5, 6, 9
a simple union of A + B with no duplicates values
Re: array and operations with others array
On Sat, 23 Jun 2007 12:16:34 +0200, artev <mailnotspammm [at] notspamm.nn>
wrote:
> two array
> A) 1, 2, 3, 4, 5, 6
> B) 4, 6, 9
>
> how can to have an array
> C) 4, 6
> all the B's values that have value in A
array_intersect($a,$b);
> and
> an array
> D) 1, 2, 3, 4, 5, 6, 9
> a simple union of A + B with no duplicates values
array_unique(array_merge($a,$b));
--
Rik Wasmus