XBRL-Equality.php
public static function unit_equal( $u1, $u2, &$types, &$namespaces )
	{
		if ( is_null( $u1 ) && is_null( $u2 ) ) return true;
		if ( is_null( $u1 ) || is_null( $u2 ) ) return false;

		// If one value is an array (divide) they must *both* be array.
		// If one value is a string (measure) they MUST *both* be string.

		if ( is_string( $u1 ) && is_string( $u2 ) )
		{
			// It's a string so it's a measure
			return XBRL_Equality::attribute_equal( $u1, $u2, XBRL_Equality::$EQUALITY_TYPE_STRING, XBRL_Equality::$EQUALITY_TYPE_STRING, $namespaces, $types );
		}

		if ( ! is_array( $u1 ) || ! is_array( $u2 ) )
		{
			return false;
		}

		// Check the arrays have the same elements
		$result = XBRL_Equality::matchedKeyNames( $u1, $u2, array( 'divide', 'measures' ) );

		if ( $result === false || ! is_array( $result ) ) return false;
		if ( ! count( $result ) ) return true;

		foreach ( $result as $elementName )
		{
			// There will be a divide or there will be measures
			switch ( $elementName )
			{
				case 'divide':

					if ( ! XBRL_Equality::divide_equal( $u1['divide'], $u2['divide'], $types, $namespaces ) )
					{
						return false;
					}

					break;

				case 'measures':

					if ( ! XBRL_Equality::measures_equal( $u1['measures'], $u2['measures'], $types, $namespaces ) )
					{
						return false;
					}

					break;
			}
		}

		return true;
	}
public static function unit_equal( $u1, $u2, &$types, &$namespaces )
	{
		if ( is_null( $u1 ) && is_null( $u2 ) ) return true;
		if ( is_null( $u1 ) || is_null( $u2 ) ) return false;

		// If one value is an array (divide) they must *both* be array.
		// If one value is a string (measure) they MUST *both* be string.

		if ( is_string( $u1 ) && is_string( $u2 ) )
		{
			// It's a string so it's a measure
			return XBRL_Equality::attribute_equal( $u1, $u2, XBRL_Equality::$EQUALITY_TYPE_STRING, XBRL_Equality::$EQUALITY_TYPE_STRING, $namespaces, $types );
		}

		if ( ! is_array( $u1 ) || ! is_array( $u2 ) )
		{
			return false;
		}

		// Check the arrays have the same elements
		$result = XBRL_Equality::matchedKeyNames( $u1, $u2, array( 'divide', 'measures' ) );

		if ( $result === false || ! is_array( $result ) ) return false;
		if ( ! count( $result ) ) return true;

		foreach ( $result as $elementName )
		{
			// There will be a divide or there will be measures
			switch ( $elementName )
			{
				case 'divide':

					if ( ! XBRL_Equality::divide_equal( $u1['divide'], $u2['divide'], $types, $namespaces ) )
					{
						return false;
					}

					break;

				case 'measures':

					if ( ! XBRL_Equality::measures_equal( $u1['measures'], $u2['measures'], $types, $namespaces ) )
					{
						return false;
					}

					break;
			}
		}

		return true;
	}
public static function unit_equal ( $ u1 , $ u2 , & $ types , & $ namespaces ) { if ( is_null ( $ u1 ) && is_null ( $ u2 ) ) return true ; if ( is_null ( $ u1 ) || is_null ( $ u2 ) ) return false ; // If one value is an array (divide) they must *both* be array.
 // If one value is a string (measure) they MUST *both* be string.
 if ( is_string ( $ u1 ) && is_string ( $ u2 ) ) { // It's a string so it's a measure
 return XBRL_Equality :: attribute_equal ( $ u1 , $ u2 , XBRL_Equality :: $ EQUALITY_TYPE_STRING , XBRL_Equality :: $ EQUALITY_TYPE_STRING , $ namespaces , $ types ) ; } if ( ! is_array ( $ u1 ) || ! is_array ( $ u2 ) ) { return false ; } // Check the arrays have the same elements
 $ result = XBRL_Equality :: matchedKeyNames ( $ u1 , $ u2 , array ( 'divide' , 'measures' ) ) ; if ( $ result === false || ! is_array ( $ result ) ) return false ; if ( ! count ( $ result ) ) return true ; foreach ( $ result as $ elementName ) { // There will be a divide or there will be measures
 switch ( $ elementName ) { case 'divide' : if ( ! XBRL_Equality :: divide_equal ( $ u1 [ 'divide' ] , $ u2 [ 'divide' ] , $ types , $ namespaces ) ) { return false ; } break ; case 'measures' : if ( ! XBRL_Equality :: measures_equal ( $ u1 [ 'measures' ] , $ u2 [ 'measures' ] , $ types , $ namespaces ) ) { return false ; } break ; } } return true ; }
Make sure unit definitions are equal

@param array $u1
@param array $u2
@param array $types		A reference to the global XBRL_Types instance
@param array $namespaces A list of the namespaces in the current document
@return false|array
Make sure unit definitions are equal