Just a note of previous research on SO:
- search under "[php] array sort" (15,000 results)
- compare two arrays where values are not in same order (does not cleanly address direct issue)
- Compare two associative arrays regarding the order of keys (different issue)
At least I believe that:
Given the example:
$arr1 = [21, 23, 25];
$arr2 = [25, 21, 23];
It the easiest, nondestructive manner to compare these for equal values, regardless of order
$arr1s = $arr1;
$arr2s = $arr2;
sort($arr1s, SORT_NUMERIC);
sort($arr2s, SORT_NUMERIC);
$isSameValues = ($arr1s === $arr2s);
Or is there an easier, cleaner way to do this?
