Q:

I want to convert C code block to equivalent PHP code

if (crc & 0x8000){
  crc = crc << 1 ^ 0x1021;
}

Above code block is in C language.
what would be the equivalent php code.

A:

You can use bitwise operators and inline hex numbers in PHP just fine. The equivalent should just be:
if ($crc & 0x8000){
  $crc = $crc << 1 ^ 0x1021;
}

