public static function compare($left, $right)
    {
        if (self::isContainer($left) && self::isContainer($right)) {
            $leftFields  = self::normalize($left);
            $rightFields = self::normalize($right);

            if (count($leftFields) !== count($rightFields)) {
                return false;
            }

            foreach ($leftFields as $key => $value) {
                if (isset($rightFields[$key])) {
                    if (!self::compare($value, $rightFields[$key])) {
                        return false;
                    }
                } else {
                    return false;
                }
            }

            return true;
        } else {
            return $left === $right;
        }
    }
public static function compare($left, $right)
    {
        if (self::isContainer($left) && self::isContainer($right)) {
            $leftFields  = self::normalize($left);
            $rightFields = self::normalize($right);

            if (count($leftFields) !== count($rightFields)) {
                return false;
            }

            foreach ($leftFields as $key => $value) {
                if (isset($rightFields[$key])) {
                    if (!self::compare($value, $rightFields[$key])) {
                        return false;
                    }
                } else {
                    return false;
                }
            }

            return true;
        } else {
            return $left === $right;
        }
    }
public static function compare ( $ left , $ right ) { if ( self :: isContainer ( $ left ) && self :: isContainer ( $ right ) ) { $ leftFields = self :: normalize ( $ left ) ; $ rightFields = self :: normalize ( $ right ) ; if ( count ( $ leftFields ) !== count ( $ rightFields ) ) { return false ; } foreach ( $ leftFields as $ key => $ value ) { if ( isset ( $ rightFields [ $ key ] ) ) { if ( ! self :: compare ( $ value , $ rightFields [ $ key ] ) ) { return false ; } } else { return false ; } } return true ; } else { return $ left === $ right ; } }
Compares whether two values are equals. Uses the comparsion rules
described in the JSON patch RFC. Basically that means that the order of
elements in objects does not matter

@see https://tools.ietf.org/html/rfc6902#section-4.6
@param mixed $left
@param mixed $right
@return boolean
Compares whether two values are equals . Uses the comparsion rules described in the JSON patch RFC . Basically that means that the order of elements in objects does not matter