Is there a built-in function for PHP for me to check whether two arrays contain the same values ( order not important?).
For example, I want a function that returns
If the arrays being compared consist of only strings and/or integers, array_count_values allows you to compare the arrays quickly (in O(n)
time vs O(n log n)
for sorting) by verifying that both arrays contain the same values and that each value occurs the same # of times in both arrays.
if(array_count_values($a1) == array_count_values($a2)) {
//arrays are equal
}