I am trying to interpret a binary string as an unsigned big endian integer, as her instructions here: http://mimesniff.spec.whatwg.org/#matches-the-signature-for-mp4 (point 4)
I'm not quite sure what I need to do here, but here are my attempts:
// ONE
$box_size = substr( $sequence, 0, 4 );
$box_size = pack( 'C*', $box_size[0], $box_size[1], $box_size[2], $box_size[3] );
$box_size = unpack( 'N*', $box_size );
// TWO
$box_size = substr( $sequence, 0, 4 );
$box_size = array_map( 'ord', str_split( $box_size ) );
// THREE
$box_size = substr( $sequence, 0, 4 );
$box_size = bindec( $box_size );
// FOUR
$box_size = substr( $sequence, 0, 4);
$box_size = (int) $box_size;
I have had no luck, and honestly am not sure what the result should even be.. Does anyone understand this? I think I might be on the right track with pack and unpack.
unpack('N', $string)should do just fine.