The description of array_diff at
http://www.php.net/manual/en/function.array-diff.php says it computes the
difference between the arrays you pass it, and returns that difference as an
array.

The behavior is that it finds and returns an array of elements that are
present in the first argument that are not present in the following
arguments, so the order in which you pass in your arrays is all-important.

I am trying to find out if two arrays are different from each other or not.
I can sort() and then compare with ==, but I thought this might be more
elegant.

Now I am looking at

       if (array_diff($one,$two) or array_diff($two,$one)) {
           /* do something */
       }

but I wonder if anyone can suggest a better way.

Thanks.

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to