3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dc09crc($data) { function calc_crc($crc, $debyte) { $deze = ord($debyte); foreach (range(0, 7) as $i) { $deze ^= $crc & 1; $crc >>= 1; if ($deze & 1) { $crc ^= 0xa001; } $deze >>= 1; } return $crc; } $crc = 0; foreach (range(0, strlen($data)-1) as $j) { $crc = calc_crc($crc, $data[$j]); } return $crc; } $response = '7CFD0011"ACK"0001#00411[]'; $t = explode('"', $response); $payload = ""; foreach(range(1, sizeof($t)-1) as $e) { echo $e; } //if ($tokens[0] != dc89crc()
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.4 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
12
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 12

preferences:
147.7 ms | 401 KiB | 135 Q