I think array_intersect() and array_diff() is useful for you..
http://www.php.net/manual/en/function.array-intersect.php
http://www.php.net/manual/en/function.array-diff.php
--
Yasuo Ohgaki
"Institute for Social Ecology" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi,
>
> I've been driving myself bonkers trying to figure out wy this code block
> does not work as it is supposed to. am hoping that someone on this list
> can shed some light on it.
>
> Whta I am trying to do is evluate two arrays. One array is populated with
> a list. The other array is populated with list items that are found in
> the first array. Array 2 can have either all of the items found in array
> 1, some, or none. I want to create a marker that would tell me which
> items in array 2 are found in array 1 and where.
>
> My code so far:
>
> for argument sake lets say:
>
> $add[$key] ($key defined earlier) is equal to "a, b, e, g"
> $add[$key] is the second array
>
> $$key is the second array, and it equals "a, b, c, d, e, f, g, h, i"
> $$key is the first array.
>
>
> code block:
>
> $x = 0;
> do
> {
> for ($y = 0; $y <= count ($add[$key]); $y++)
> {
> if ($add[$key][$y] == $$key[$x])
> {
> $mark[$x] = $x;
> }
> }
> $x++;
> }while ($x < count ($$key));
>
> So, the idea is that every time $add[$key] at "Y" position is equal to
> $$key at X position, a third array is populated with the location value of X.
>
> but this is not what I am getting spti back at me. $mark is populated
> every iteration of the inner loop regardless if $add[$key][$y] ==
> $$key[$x]
>
> Any suggestions?
>
> thanks!
>
> Michael
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]