<?php function highestBitsOfByte(int $byte, int $count = 2):int { if($count < 0 OR $count > 8) return false; //Error return ($byte&0xFF) >> (8-$count); } $input = 0b10011110; $r = highestBitsOfByte($input,2); echo sprintf('%08b',$r);
You have javascript disabled. You will not be able to edit any code.