/** * Compares arrays (unique values). * * @see https://wpcodebook.com/compare-arrays-unique-values-php/ */ function wpcodebook_compare_arrays( $array1, $array2 ) { $array1 = array_unique( $array1 ); $array2 = array_unique( $array2 ); return ( count( $array1 ) === count( $array2 ) && ! array_diff( $array1, $array2 ) ); }