public static function decodeFilterASCIIHexDecode($data) {
		// intialize string to return
		$decoded = '';
		// all white-space characters shall be ignored
		$data = preg_replace('/[\s]/', '', $data);
		// check for EOD character: GREATER-THAN SIGN (3Eh)
		$eod = strpos($data, '>');
		if ($eod !== false) {
			// remove EOD and extra data (if any)
			$data = substr($data, 0, $eod);
			$eod = true;
		}
		// get data length
		$data_length = strlen($data);
		if (($data_length % 2) != 0) {
			// odd number of hexadecimal digits
			if ($eod) {
				// EOD shall behave as if a 0 (zero) followed the last digit
				$data = substr($data, 0, -1).'0'.substr($data, -1);
			} else {
				self::Error('decodeFilterASCIIHexDecode: invalid code');
			}
		}
		// check for invalid characters
		if (preg_match('/[^a-fA-F\d]/', $data) > 0) {
			self::Error('decodeFilterASCIIHexDecode: invalid code');
		}
		// get one byte of binary data for each pair of ASCII hexadecimal digits
		$decoded = pack('H*', $data);
		return $decoded;
	}
public static function decodeFilterASCIIHexDecode($data) {
		// intialize string to return
		$decoded = '';
		// all white-space characters shall be ignored
		$data = preg_replace('/[\s]/', '', $data);
		// check for EOD character: GREATER-THAN SIGN (3Eh)
		$eod = strpos($data, '>');
		if ($eod !== false) {
			// remove EOD and extra data (if any)
			$data = substr($data, 0, $eod);
			$eod = true;
		}
		// get data length
		$data_length = strlen($data);
		if (($data_length % 2) != 0) {
			// odd number of hexadecimal digits
			if ($eod) {
				// EOD shall behave as if a 0 (zero) followed the last digit
				$data = substr($data, 0, -1).'0'.substr($data, -1);
			} else {
				self::Error('decodeFilterASCIIHexDecode: invalid code');
			}
		}
		// check for invalid characters
		if (preg_match('/[^a-fA-F\d]/', $data) > 0) {
			self::Error('decodeFilterASCIIHexDecode: invalid code');
		}
		// get one byte of binary data for each pair of ASCII hexadecimal digits
		$decoded = pack('H*', $data);
		return $decoded;
	}
public static function decodeFilterASCIIHexDecode ( $ data ) { // intialize string to return $ decoded = '' ; // all white-space characters shall be ignored $ data = preg_replace ( '/[\s]/' , '' , $ data ) ; // check for EOD character: GREATER-THAN SIGN (3Eh) $ eod = strpos ( $ data , '>' ) ; if ( $ eod !== false ) { // remove EOD and extra data (if any) $ data = substr ( $ data , 0 , $ eod ) ; $ eod = true ; } // get data length $ data_length = strlen ( $ data ) ; if ( ( $ data_length % 2 ) != 0 ) { // odd number of hexadecimal digits if ( $ eod ) { // EOD shall behave as if a 0 (zero) followed the last digit $ data = substr ( $ data , 0 , - 1 ) . '0' . substr ( $ data , - 1 ) ; } else { self :: Error ( 'decodeFilterASCIIHexDecode: invalid code' ) ; } } // check for invalid characters if ( preg_match ( '/[^a-fA-F\d]/' , $ data ) > 0 ) { self :: Error ( 'decodeFilterASCIIHexDecode: invalid code' ) ; } // get one byte of binary data for each pair of ASCII hexadecimal digits $ decoded = pack ( 'H*' , $ data ) ; return $ decoded ; }
ASCIIHexDecode
Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
@param $data (string) Data to decode.
@return Decoded data string.
@since 1.0.000 (2011-05-23)
@public static
ASCIIHexDecode Decodes data encoded in an ASCII hexadecimal representation reproducing the original binary data .