Tells if two objects are equals.

@category Internal Functions

@param mixed $a the first value
@param mixed $b the second $value
@param array $aStack the first recursion stack
@param array $bStack the second recursion stack

@return bool
421607
protected static function equal($a, $b, $aStack, $bStack)
    {
        // Unwrap any wrapped object.
        $a instanceof self && $a = $a->_wrapped;
        $b instanceof self && $b = $b->_wrapped;

        if ($a === null && $b === null)
            return true;

        // Two resources are always considered different since there is no way to compare them
        if (is_resource($a) && is_resource($b))
            return false;

        // Perform classic scalar comparison.
        if (is_scalar($a) && is_scalar($b))
            return $a == $b;

        // Assume equality for cyclic structures. The algorithm for detecting cyclic structures is adapted from
        // ES 5.1 section 15.12.3, abstract operation JO.
        $length = count($aStack);
        while ($length--)
            if ($aStack[$length] == $a)
                return $bStack[$length] == $b;

        // Add the first object to the stack of traversed objects.
        $aStack[] = $a;
        $bStack[] = $b;

        $result = true;
        $size = 0;

        if (static::isTraversable($a) && static::isTraversable($b)) {
            // Try to deep compare sequences.
            static::each($a, function ($item, $key) use (& $a, & $b, & $aStack, & $bStack, & $size, & $result) {
                $size++;

                $result = static::has($b, $key) && static::equal(
                    static::get($a, $key),
                    static::get($b, $key),
                    $aStack,
                    $bStack
                );

                if (!$result)
                    return static::BREAKER;
            });

            if ($size != static::size($b))
                $result = false;
        }
        else {
            // Last hope comparison.
            $result = $a == $b;
        }

        // Remove the first object from the stack of traversed objects.
        array_pop($aStack);
        array_pop($aStack);

        return $result;
    }
1373987
private function valuesAreEqual($a, $b)
    {
        if (is_array($a) && is_array($b)) {
            ksort($a);
            ksort($b);
        }

        return $a === $b;
    }
997486
protected function compare($a, $b)
    {
        switch ($this->operator) {
            case '=':
            case '==': return $a == $b;
            case '!=': return $a != $b;
            case '<':  return $a < $b;
            case '>':  return $a > $b;
            case '<=': return $a <= $b;
            case '>=': return $a >= $b;
        }
    }
633197
public function equals(Statement $statement): bool
    {
        if (null !== $this->id xor null !== $statement->id) {
            return false;
        }

        if (null !== $this->id && null !== $statement->id && !$this->id->equals($statement->id)) {
            return false;
        }

        if (!$this->actor->equals($statement->actor)) {
            return false;
        }

        if (!$this->verb->equals($statement->verb)) {
            return false;
        }

        if (!$this->object->equals($statement->object)) {
            return false;
        }

        if (null === $this->result && null !== $statement->result) {
            return false;
        }

        if (null !== $this->result && null === $statement->result) {
            return false;
        }

        if (null !== $this->result && !$this->result->equals($statement->result)) {
            return false;
        }

        if (null === $this->authority && null !== $statement->authority) {
            return false;
        }

        if (null !== $this->authority && null === $statement->authority) {
            return false;
        }

        if (null !== $this->authority && !$this->authority->equals($statement->authority)) {
            return false;
        }

        if ($this->created != $statement->created) {
            return false;
        }

        if (null !== $this->context xor null !== $statement->context) {
            return false;
        }

        if (null !== $this->context && null !== $statement->context && !$this->context->equals($statement->context)) {
            return false;
        }

        if (null !== $this->attachments xor null !== $statement->attachments) {
            return false;
        }

        if (null !== $this->attachments && null !== $statement->attachments) {
            if (count($this->attachments) !== count($statement->attachments)) {
                return false;
            }

            foreach ($this->attachments as $key => $attachment) {
                if (!$attachment->equals($statement->attachments[$key])) {
                    return false;
                }
            }
        }

        return true;
    }
581887
function areEqual(a: any, b: any): boolean {
  const aStack = aStackPool.length ? aStackPool.pop() : [];
  const bStack = bStackPool.length ? bStackPool.pop() : [];
  const result = eq(a, b, aStack, bStack);
  aStack.length = 0;
  bStack.length = 0;
  aStackPool.push(aStack);
  bStackPool.push(bStack);
  return result;
}
1227877
function isEqual(a, b)
{
	// objects are directly equal
	if(a === b){
		return true;
	}
	// recurse for each pair of array items
	else if( Array.isArray(a) && Array.isArray(b) && a.length === b.length ){
		return a.every( function (v,i) { return isEqual(a[i], b[i]); } );
	}
	// recurse for every key/val pair in objects
	else if( a instanceof Object && b instanceof Object
		&& isEqual(Object.keys(a).sort(), Object.keys(b).sort()) )
	{
		for(var k in a){
			if( !isEqual(a[k], b[k]) )
				{ return false; }
		}
		return true;
	}
	else {
		return false;
	}
}
1240633
protected function compare($a, $b)
    {
        if (is_null($this->comparator)) {
            if ($a < $b) {
                return -1;
            }
            if ($a > $b) {
                return 1;
            }
            return 0;
        }

        return call_user_func($this->comparator, $a, $b);
    }
1136764
private static function callbackEquals( $callback1, $callback2 ) {

			if ( is_array( $callback1 ) && is_array( $callback2 ) ) {
				
				if ( count( $callback1 ) == count( $callback2 ) ) {
				
					for ( $i=0, $len = count( $callback1 ); $i<$len; $i++ ) {
						if ( $callback1[$i] != $callback2[$i] ) {
							return false;
						}
					}

					return true;

				} else {
					
					return false;
				
				}

			} else {

				return $callback1 == $callback2;

			}

		}
299327
function( a, b, aParent, bParent, parentProp, compares, options ){
		var bType = typeof b;
		var hasAdditionalProp = false;
		if(bType === 'object' || bType === 'function') {
			var aCopy = assign({}, a);
			if(options.deep === false) {
				options.deep = -1;
			}
			// Check that everything in B is the same as whats in A, or
			// isn't in A.
			for (var prop in b) {
				var compare = compares[prop] === undefined ? compares['*'] : compares[prop];
				// run the comparison no matter what
				var compareResult = loop(a[prop], b[prop], a, b, prop, compare, options );
				// if there wasn't a prop (and we didn't run through a compare)
				if(compareResult === h.ignoreType) {
					// do nothing
				} else if(!(prop in a) ||  options.performedDifference ) {
					hasAdditionalProp = true;
				} else if(!compareResult) {
					return false;
				}
				delete aCopy[prop];
			}
			// go through aCopy props ... if there is no compare .. return false
			for (prop in aCopy) {
				if (compares[prop] === undefined || !loop(a[prop], undefined, a, b, prop, compares[prop], options) ) {
					return false;
				}
			}
			return hasAdditionalProp;
		}

	}
164596
function arrayEquals(arrayA, arrayB) {
	"use strict";

	// if the other array is a falsy value, return
	if (!arrayB || !arrayA) {
		return false;
	}

	// compare lengths - can save a lot of time
	if (arrayA.length !== arrayB.length) {
		return false;
	}

	for (var i = 0; i < arrayA.length; i++) {
		// Check if we have nested arrays
		if (arrayA[i] instanceof Array && arrayB[i] instanceof Array) {
			// recurse into the nested arrays
			if (!arrayEquals(arrayA[i], arrayB[i])) {
				return false;
			}
		}
		else if (arrayA[i] !== arrayB[i]) {
			// Warning - two different object instances will never be equal: {x:20} != {x:20}
			return false;
		}
	}
	return true;
}
1216323
private boolean digests_equals(final byte[] a, final byte[] b) {
        int i;
        for (i = 0; i < 16; ++i) {
            if (a[i] != b[i]) {
                return false;
            }
        }
        return true;
    }
513970
function _equals(a, b) {
    if (a === b) {
        return true;
    }

    const aType = $type(a);

    if (aType != $type(b)) {
        return false;
    }

    if (aType == 'array') {
        return _arrEquals(a, b);
    }

    if (aType == 'object') {
        return _objEquals(a, b);
    }

    if (aType == 'date') {
        return +a == +b;
    }

    return false;
}
151093
public static boolean areEqual(byte[] a, byte[] b) {
        int aLength = a.length;
        if (aLength != b.length) {
            return false;
        }

        for (int i = 0; i < aLength; i++) {
            if (a[i] != b[i]) {
                return false;
            }
        }
        return true;
    }
313569
public static boolean arrayEquals(List<String> a, List<String> b) {
        if (a == null) {
            a = new ArrayList<>();
        }
        if (b == null) {
            b = new ArrayList<>();
        }
        if (a.size() != b.size()) {
            return false;
        }

        for (int i = 0; i < a.size(); i ++) {
            if (!a.get(i).equals(b.get(i))) {
                return false;
            }
        }
        return true;
    }
230082
protected static function uksortMatchFunc($a, $b)
	{
		$posa = array_search($a, self::$uksortMatchList);
		$posb = array_search($b, self::$uksortMatchList);
		if ($posa == $posb) {
			return 0;
		} else {
			return $posa > $posb ? 1 : -1;
		}
	}
91183
public static function compare(Version $a, Version $b)
    {
        $aValues = $a->numeric();
        $bValues = $b->numeric();

        foreach (array_keys(self::$ordinality) as $key) {
            $aVal = $aValues[$key];
            $bVal = $bValues[$key];

            if ($aVal < $bVal) {
                return -1;
            } elseif ($aVal > $bVal) {
                return 1;
            }
        }
        return 0;
    }
349467
public function Compare($a, $b)
    {
        $this->preOpMethodParamsCheck(array($a, $b));

        return $this->math->comp($a, $b);
    }