getid3_lib::BigEndian2String

Advertisement

Syntax Syntax

getid3_lib::BigEndian2String( int $number, int $minbytes = 1, bool $synchsafe = false, bool $signed = false )

Parameters Parameters

$number

(int) (Required)

$minbytes

(int) (Optional)

Default value: 1

$synchsafe

(bool) (Optional)

Default value: false

$signed

(bool) (Optional)

Default value: false

Return Return

(string)

Source Source

File: wp-includes/ID3/getid3.lib.php

		}
		$maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF);
		$intstring = '';
		if ($signed) {
			if ($minbytes > PHP_INT_SIZE) {
				throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits in self::BigEndian2String()');
			}
			$number = $number & (0x80 << (8 * ($minbytes - 1)));
		}
		while ($number != 0) {
			$quotient = ($number / ($maskbyte + 1));
			$intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring;
			$number = floor($quotient);
		}
		return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT);
	}

	/**
	 * @param int $number

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.