So I had a bug in some code where I was doing an array_udiff() on arrays of arrays, thinking the callback function would basically want to return true if they were different and false if they were not. On careful examination, I noticed that the PHP docs say the comparison function needs to return -1, 0, or 1 (similar to a sort).
Not knowing how to compare an array to see if it’s less than another array I took a stab just using standard < and > operators… it seems to have worked, but I have no idea how it works or on what basis it determines $a < $b when $a and $b are arrays, let alone why the compare function even needs to do that.
Anyone?
submitted by /u/mjsdev
[link] [comments]