Avifinfo

read_big_endian()WP 1.0

Reads an unsigned integer with most significant bits first.

Хуков нет.

Возвращает

int. Value.

Использование

read_big_endian( $input, $num_bytes );
$input (обязательный)
-
$num_bytes(int) (обязательный)
Number of parsed bytes.

Код read_big_endian() WP 6.6.2

function read_big_endian( $input, $num_bytes ) {
  if ( $num_bytes == 1 ) {
    return unpack( 'C', $input ) [1];
  } else if ( $num_bytes == 2 ) {
    return unpack( 'n', $input ) [1];
  } else if ( $num_bytes == 3 ) {
    $bytes = unpack( 'C3', $input );
    return ( $bytes[1] << 16 ) | ( $bytes[2] << 8 ) | $bytes[3];
  } else { // $num_bytes is 4
    // This might fail to read unsigned values >= 2^31 on 32-bit systems.
    // See https://www.php.net/manual/en/function.unpack.php#106041
    return unpack( 'N', $input ) [1];
  }
}