PHP 8.5.0 Alpha 1 available for testing

Voting

: four plus two?
(Example: nine)

The Note You're Voting On

spectrumizer at cycos dot net
22 years ago
Here is a tested and working CRC16-Algorithm:

<?php
function crc16($string) {
$crc = 0xFFFF;
for (
$x = 0; $x < strlen ($string); $x++) {
$crc = $crc ^ ord($string[$x]);
for (
$y = 0; $y < 8; $y++) {
if ((
$crc & 0x0001) == 0x0001) {
$crc = (($crc >> 1) ^ 0xA001);
} else {
$crc = $crc >> 1; }
}
}
return
$crc;
}
?>

Regards,
Mario

<< Back to user notes page

To Top