public static function arrayDiffRecursive(array $array1, array $array2, $valuesOnly = false)
    {
        $effect = [];

        /*
         * Values should be compared only and both arrays are one-dimensional?
         * Let's find difference by using simple function
         */
        if ($valuesOnly && 1 === self::getDimensionsCount($array1) && 1 === self::getDimensionsCount($array2)) {
            return array_diff($array1, $array2);
        }

        foreach ($array1 as $key => $value) {
            $array2HasKey = array_key_exists($key, $array2);

            // Values should be compared only?
            if ($valuesOnly) {
                $difference = null;

                if (is_array($value)) {
                    if ($array2HasKey && is_array($array2[$key])) {
                        $difference = self::arrayDiffRecursive($value, $array2[$key], $valuesOnly);
                    }
                } elseif (!$array2HasKey || ($array2HasKey && $value !== $array2[$key])) {
                    /*
                     * We are here, because:
                     * a) 2nd array hasn't key from 1st array
                     * OR
                     * b) key exists in both, 1st and 2nd array, but values are different
                     */
                    $difference = $value;
                }

                if (null !== $difference) {
                    $effect[] = $difference;
                }

                // The key exists in 2nd array?
            } elseif ($array2HasKey) {
                // The value it's an array (it's a nested array)?
                if (is_array($value)) {
                    $diff = [];

                    if (is_array($array2[$key])) {
                        // Let's verify the nested array
                        $diff = self::arrayDiffRecursive($value, $array2[$key], $valuesOnly);
                    }

                    if (empty($diff)) {
                        continue;
                    }

                    $effect[$key] = $diff;
                } elseif ($value !== $array2[$key]) {
                    // Value is different than in 2nd array?
                    // OKay, I've got difference
                    $effect[$key] = $value;
                }
            } else {
                // OKay, I've got difference
                $effect[$key] = $value;
            }
        }

        return $effect;
    }