3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo sprintf("%x",getCrc16("\x08\x02\x00\x00\x01\x43\xEF\x3A", 0, 0xA001, 0)); function getCrc16($buffer, $offset, $polynom, $preset) { $preset &= 0xFFFF; $polynom &= 0xFFFF; $bufLen = strlen($buffer); $crc = $preset; for($i = 0; $i < $bufLen; $i++) { $data = ord($buffer[($i + $offset)%$bufLen); $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 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
Parse error: syntax error, unexpected ')', expecting ']' in /in/f9tIm on line 12
Process exited with code 255.

preferences:
179.78 ms | 1395 KiB | 61 Q