Compare arrays ignoring the position of the elements
@param array $value1
@param array $value2
@return bool
339420
public static function compare_arrays( $value1, $value2 )
	{
		if ( count( $value1 ) != count( $value2 ) ) return false;

		$types = XBRL_Types::getInstance();

		foreach ( $value1 as $key => $value )
		{
			if ( ! isset( $value2[ $key ] ) ) return false;

			if ( $key == 'id' )
			{
				$pattern = "/^" . SchemaTypes::$ncName . "$/u";
				if ( ! preg_match( $pattern, $value, $matches ) )
				{
					$this->log()->taxonomy_validation( "context", "id attribute is not a valid NCName", array( 'id' => $value ) );
				}
				if ( ! preg_match( $pattern, $value2[ $key ], $matches ) )
				{
					$this->log()->taxonomy_validation( "context", "id attribute is not a valid NCName", array( 'id' => $value[ $key ] ) );
				}
			}

			if ( is_array( $value ) )
			{
				if ( ! is_array( $value2[ $key ] ) ) return false;

				// These arrays will represent a collection of elements (the key will be 'children') so compare them in order
				if ( ! XBRL_Equality::compare_arrays_ordinal( $value, $value2[ $key ]) )
				{
					return false;
				}

				continue;
			}
			else if ( in_array( $key, array( 'id', 'name', 'prefix', 'type' ) ) )
			{
				if ( $value != $value2[ $key ] )
				{
					return false;
				}

				continue;
			}

			// These can be attribute comparisons so if not the element value look for an attribute and get the type
			$aType = $key == 'value'
				? XBRL_Equality::xequalElementType( $types, $value1['name'], isset( $value1['prefix'] ) ? $value1['prefix'] : null )
				: XBRL_Equality::xequalAttributeType( $types, $key, isset( $value1['prefix'] ) ? $value1['prefix'] : null );

			$bType = $key == 'value'
				? XBRL_Equality::xequalElementType( $types, $value2['name'], isset( $value2['prefix'] ) ? $value2['prefix'] : null )
				: XBRL_Equality::xequalAttributeType( $types, $key, isset( $value2['prefix'] ) ? $value2['prefix'] : null );

			if ( ! XBRL_Equality::xequal( $value, $value2[ $key ], $aType, $bType, $types ) )
			{
				return false;
			}

		}

		return true;
	}
1100135
public static function array_diff_multi($array1, $array2)
    {

        $res = array();
        foreach ($array1 as $entry) {
            if (!in_array($entry, $array2)) {
                $res[] = $entry;
            }
        }

        return $res;
    }
923887
public static function areRecursivelyEquals(array $array1, array $array2)
    {
        if (\count($array1) !== \count($array2)) {
            return false;
        }

        return self::arrayIsContained($array1, $array2);
    }
842472
public static int compare(Point offset, BlockPos pos1, BlockPos pos2)
	{
		if (pos1.equals(pos2))
			return 0;

		return Double.compare(pos1.distanceSq(offset.x, offset.y, offset.z), pos2.distanceSq(offset.x, offset.y, offset.z));
	}
941807
public static function arrayIsContained(array $array1, array $array2)
    {
        foreach ($array1 as $key => $value1) {
            if (!array_key_exists($key, $array2)) {
                return false;
            }
            if (!self::haveTheSameTypeAndValue($value1, $array2[$key])) {
                return false;
            }
        }

        return true;
    }
1370115
static function compareValues($array1, $array2, $strict = false) {
		if (count($array1) != count($array2)) return false;

		$array1 = array_values($array1);
		$array2 = array_values($array2);
		sort($array1, SORT_STRING);
		sort($array2, SORT_STRING);

		foreach($array1 as $i=>$r) {
			if ($array2[$i] != $r) return false;
			if ($strict and $array2[$i] !== $r) return false;
		}

		return true;
	}
939051
protected function min(float $value1 = null, float $value2 = null) {
        $temp1 = $value1 ?: 0;
        $temp2 = $value2 ?: 0;

        $tempmin = min($temp1, $temp2);

        if (!$tempmin && $value1 !== 0 && $value2 !== 0) {
            $min = null;
        } else {
            $min = $tempmin;
        }

        return $min;
    }
1085934
public function whereBetween(string $field, $value1, $value2)
    {
        return $this->addCondition('AND', $field, [$value1, $value2], 'BETWEEN');
    }
991184
protected function max(float $value1 = null, float $value2 = null) {
        $temp1 = $value1 ?: 0;
        $temp2 = $value2 ?: 0;

        $tempmax = max($temp1, $temp2);

        if (!$tempmax && $value1 !== 0 && $value2 !== 0) {
            $max = null;
        } else {
            $max = $tempmax;
        }

        return $max;
    }
102940
protected function hasIntersectArray(array $array1, array $array2)
    {
        foreach ($array1 as $value) {
            if (in_array($value, $array2)) {
                return true;
            }
        }

        return false;
    }
93961
public static boolean startsWith(Object array1[], Object array2[]){
        return equals(array1, 0, array2, 0, array2.length);
    }
878595
public static function equal(array $array1, array $array2)
    {
        if (static::count($array1) != static::count($array2)) {
            return false;
        } else {
            for ($i = 0; $i < static::count($array1); $i++) {
                if ($array1[$i] != $array2[$i]) {
                    return false;
                }
            }
        }

        return true;
    }
935073
private static function compareArrays(array $input1, array $input2)
    {
        foreach ($input1 as $key => $value) {
            if (!array_key_exists($key, $input2)) {
                return false;
            } else {
                if (!self::isStructureSame($value, $input2[$key])) {
                    return false;
                }
            }
        }

        return true;
    }
126327
public function orNotBetween($column, $value1, $value2)
	{
		return $this->between($column, $value1, $value2, 'OR', true);
	}
856840
private static function arrayDiffRecursive(array $array1, array $array2)
    {
        $finalArray = [];
        foreach ($array1 as $KeyArray1 => $ValueArray1) {
            if (array_key_exists($KeyArray1, $array2)) {
                if (is_array($ValueArray1)) {
                    $arrayDiffRecursive = self::arrayDiffRecursive($ValueArray1, $array2[$KeyArray1]);
                    if (count($arrayDiffRecursive)) {
                        $finalArray[$KeyArray1] = $arrayDiffRecursive;
                    }
                }
            } else {
                $finalArray[$KeyArray1] = $ValueArray1;
            }
        }

        return $finalArray;
    }
280763
public static function EqualsValue( $val1, $val2 )
	{
		switch ( ValueProxy::$conv_t[ $val1->GetValueCode() ][ $val2->GetValueCode() ] )
		{
			case -1:
				return $val2->Promote( $val1 )->Eq( $val2 );

			case 0:
				return $val1->Eq( $val2 );

			case 1:
				return $val1->Eq( $val1->Promote( $val2 ) );

			default:

				if ( ValueProxy::$conv_t[ $val2->GetValueCode() ][ $val1->GetValueCode() ] == 1 )
				{
					return $val2->Promote( $val1 )->Eq( $val2 );
				}

				throw XPath2Exception::withErrorCodeAndParams( "", Resources::BinaryOperatorNotDefined,
					array(
						"op:eq",
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $val1 ), XmlTypeCardinality::One ),
						SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $val2 ), XmlTypeCardinality::One )
					)
				);
		}
	}
435572
public function update($value1, $value2) // [\SEIDS\Heaps\AbstractHeap]
	{
		$v = $this->hashtIndex($value1);
		
		if(empty($this->hasht[$v]))
		{
			throw new UpdateException('Unable to find element in heap');
		}
		else
		{
			$t = array_keys($this->hasht[$v])[0];
			$i = $this->hasht[$v][$t];
			
			$this->btree[$i] = new Item($value2, $t);
			
			unset($this->hasht[$v][$t]);
			
			if(empty($this->hasht[$v]))
			{
				unset($this->hasht[$v]);
			}
			
			$this->hasht[$this->hashtIndex($value2)][$t] = $i;
			
			$this->siftUp($i);
			$this->siftDown($i);
		}
	}