3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo sprintf("%x",getCrc16("\x08\x02\x00\x00\x01\x43\xEF\x3A", 0, 0xA001, 0)).'<br />'; function getCrc16($buffer, $offset, $polynom, $preset) { $preset &= 0xFFFF; $polynom &= 0xFFFF; $bufLen = strlen($buffer); $crc = $preset; for($i = 0; $i < $bufLen; $i++) { $data = $buffer[($i + $offset)%$bufLen] & 0xFF; $crc ^= $data; for ($j = 0; $j < 8; $j++) { if (($crc & 0x0001) != 0) { $crc = ($crc >> 1) ^ $polynom; } else { $crc = $crc >> 1; } } } return $crc & 0xFFFF; }
Output for 7.1.0
Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 Warning: A non-numeric value encountered in /in/NdvR5 on line 12 0<br />
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.0.14
0<br />
Output for hhvm-3.10.0

Process exited with code 153.