3v4l.org

run code in 300+ PHP versions simultaneously
<?php //DOMANDA: 0x55 0x82 0x30 0x01 0x33 0x33 0x91 //RISPOSTA: 0x55 0x82 0xB0 0x01 0x00 0x05 0x72 function CheckSumCalculation($hex) { $dsum=0; for ($i=1; $i < strlen($hex)-1; $i+=4){ $dsum += hexdec($hex[$i].$hex[$i+1]); } $NotSum = ~$dsum; $ChkSum = substr(dechex($NotSum), -2); return $ChkSum; } $LstIA = array("64","65","66","67","68","69","6A","6B","6C"); foreach ($LstIA as &$addr) { $value = $addr * 2; $DXPcmd = "\$55,\$82,\$10,\$".$addr.",\$33,\$33"; $DXPcmd .= ",\$".CheckSumCalculation($DXPcmd); echo "<BR>".$DXPcmd; } //0x55 0x82 0x30 0x01 0x33 0x33 $DXPcmd = "\$55,\$82,\$30,\$01,\$33,\$33"; $DXPcmd .= ",\$".CheckSumCalculation($DXPcmd); echo "<BR>".$DXPcmd; ?>
Output for 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
<BR>$55,$82,$10,$64,$33,$33,$4e<BR>$55,$82,$10,$65,$33,$33,$4d<BR>$55,$82,$10,$66,$33,$33,$4c<BR>$55,$82,$10,$67,$33,$33,$4b<BR>$55,$82,$10,$68,$33,$33,$4a<BR>$55,$82,$10,$69,$33,$33,$49 Warning: A non-numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6A,$33,$33,$48 Warning: A non-numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6B,$33,$33,$47 Warning: A non-numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6C,$33,$33,$46<BR>$55,$82,$30,$01,$33,$33,$91
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 <BR>$55,$82,$10,$64,$33,$33,$4e<BR>$55,$82,$10,$65,$33,$33,$4d<BR>$55,$82,$10,$66,$33,$33,$4c<BR>$55,$82,$10,$67,$33,$33,$4b<BR>$55,$82,$10,$68,$33,$33,$4a<BR>$55,$82,$10,$69,$33,$33,$49 Warning: A non-numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6A,$33,$33,$48 Warning: A non-numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6B,$33,$33,$47 Warning: A non-numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6C,$33,$33,$46<BR>$55,$82,$30,$01,$33,$33,$91
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
<BR>$55,$82,$10,$64,$33,$33,$4e<BR>$55,$82,$10,$65,$33,$33,$4d<BR>$55,$82,$10,$66,$33,$33,$4c<BR>$55,$82,$10,$67,$33,$33,$4b<BR>$55,$82,$10,$68,$33,$33,$4a<BR>$55,$82,$10,$69,$33,$33,$49 Notice: A non well formed numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6A,$33,$33,$48 Notice: A non well formed numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6B,$33,$33,$47 Notice: A non well formed numeric value encountered in /in/lq6Ib on line 22 <BR>$55,$82,$10,$6C,$33,$33,$46<BR>$55,$82,$30,$01,$33,$33,$91
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.3.32 - 7.3.33
<BR>$55,$82,$10,$64,$33,$33,$4e<BR>$55,$82,$10,$65,$33,$33,$4d<BR>$55,$82,$10,$66,$33,$33,$4c<BR>$55,$82,$10,$67,$33,$33,$4b<BR>$55,$82,$10,$68,$33,$33,$4a<BR>$55,$82,$10,$69,$33,$33,$49<BR>$55,$82,$10,$6A,$33,$33,$48<BR>$55,$82,$10,$6B,$33,$33,$47<BR>$55,$82,$10,$6C,$33,$33,$46<BR>$55,$82,$30,$01,$33,$33,$91

preferences:
170.63 ms | 403 KiB | 226 Q