XBRL-Equality.php
public static function compare_arrays_ordinal( $array1, $array2 )
	{
		if ( count( $array1 ) != count( $array2 ) ) return false;
		if ( ! count( $array1 ) ) return true;

		$types = XBRL_Types::getInstance();

		for( $i = 0; $i < count( $array1 ); $i++ )
		{
			$key1 = key( $array1 );
			$key2 = key( $array2 );

			if (  $key1 != $key2 ) return false;

			$value1 = current( $array1 );
			$value2 = current( $array2 );

			next( $array1 );
			next( $array2 );

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

			if ( is_array( $value1 ) )
			{
				if ( ! is_array( $value2 ) ) return false;

				// These arrays will represent elements so compare the contents by name
				if ( ! XBRL_Equality::compare_arrays( $value1, $value2 ) )
				{
					return false;
				}
			}
			else if ( in_array( $key1, array( 'id', 'name', 'prefix', 'type' ) ) )
			{
				if ( $value1 != $value2 )
				{
					return false;
				}
			}
			else
			{
				$value1Type = XBRL_Equality::xEqualComparisonType( $value1, $types );
				$value2Type = XBRL_Equality::xEqualComparisonType( $value2, $types );
				if ( ! XBRL_Equality::xequal( $value1, $value2, $value1Type, $value2Type, $types ) )
				{
					return false;
				}
			}
		}

		return true;
	}
public static function compare_arrays_ordinal( $array1, $array2 )
	{
		if ( count( $array1 ) != count( $array2 ) ) return false;
		if ( ! count( $array1 ) ) return true;

		$types = XBRL_Types::getInstance();

		for( $i = 0; $i < count( $array1 ); $i++ )
		{
			$key1 = key( $array1 );
			$key2 = key( $array2 );

			if (  $key1 != $key2 ) return false;

			$value1 = current( $array1 );
			$value2 = current( $array2 );

			next( $array1 );
			next( $array2 );

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

			if ( is_array( $value1 ) )
			{
				if ( ! is_array( $value2 ) ) return false;

				// These arrays will represent elements so compare the contents by name
				if ( ! XBRL_Equality::compare_arrays( $value1, $value2 ) )
				{
					return false;
				}
			}
			else if ( in_array( $key1, array( 'id', 'name', 'prefix', 'type' ) ) )
			{
				if ( $value1 != $value2 )
				{
					return false;
				}
			}
			else
			{
				$value1Type = XBRL_Equality::xEqualComparisonType( $value1, $types );
				$value2Type = XBRL_Equality::xEqualComparisonType( $value2, $types );
				if ( ! XBRL_Equality::xequal( $value1, $value2, $value1Type, $value2Type, $types ) )
				{
					return false;
				}
			}
		}

		return true;
	}
public static function compare_arrays_ordinal ( $ array1 , $ array2 ) { if ( count ( $ array1 ) != count ( $ array2 ) ) return false ; if ( ! count ( $ array1 ) ) return true ; $ types = XBRL_Types :: getInstance ( ) ; for ( $ i = 0 ; $ i < count ( $ array1 ) ; $ i ++ ) { $ key1 = key ( $ array1 ) ; $ key2 = key ( $ array2 ) ; if ( $ key1 != $ key2 ) return false ; $ value1 = current ( $ array1 ) ; $ value2 = current ( $ array2 ) ; next ( $ array1 ) ; next ( $ array2 ) ; if ( $ key1 == 'id' ) { $ pattern = "/^" . SchemaTypes :: $ ncName . "$/u" ; if ( ! preg_match ( $ pattern , $ value1 , $ matches ) ) { $ this -> log ( ) -> taxonomy_validation ( "context" , "id attribute is not a valid NCName" , array ( 'id' => $ value1 ) ) ; } if ( ! preg_match ( $ pattern , $ value2 , $ matches ) ) { $ this -> log ( ) -> taxonomy_validation ( "context" , "id attribute is not a valid NCName" , array ( 'id' => $ value2 ) ) ; } } if ( is_array ( $ value1 ) ) { if ( ! is_array ( $ value2 ) ) return false ; // These arrays will represent elements so compare the contents by name
 if ( ! XBRL_Equality :: compare_arrays ( $ value1 , $ value2 ) ) { return false ; } } else if ( in_array ( $ key1 , array ( 'id' , 'name' , 'prefix' , 'type' ) ) ) { if ( $ value1 != $ value2 ) { return false ; } } else { $ value1Type = XBRL_Equality :: xEqualComparisonType ( $ value1 , $ types ) ; $ value2Type = XBRL_Equality :: xEqualComparisonType ( $ value2 , $ types ) ; if ( ! XBRL_Equality :: xequal ( $ value1 , $ value2 , $ value1Type , $ value2Type , $ types ) ) { return false ; } } } return true ; }
Compare arrays using the position of the elements
@param array $array1
@param array $array2
@return bool
Compare arrays using the position of the elements