3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //DOMANDA: 0x55 0x82 0x30 0x01 0x33 0x33 0x91 //RISPOSTA: 0x55 0x82 0xB0 0x01 0x00 0x05 0x72 function CheckSumCalculation($hex) { $dsum=0; for ($i=0; $i < strlen($hex)-1; $i+=2){ $SUM += 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 = "558210".$addr."3333"; $DXPcmd .= CheckSumCalculation($DXPcmd); echo "<BR>".$DXPcmd; } ?>
based on ujrQo
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210643333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210653333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210663333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210673333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210683333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210693333ff Notice: A non well formed numeric value encountered in /in/1l4Af on line 22 Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>5582106A3333ff Notice: A non well formed numeric value encountered in /in/1l4Af on line 22 Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>5582106B3333ff Notice: A non well formed numeric value encountered in /in/1l4Af on line 22 Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>5582106C3333ff
Output for 5.3.22 - 7.0.20
Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210643333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210653333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210663333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210673333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210683333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>558210693333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>5582106A3333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>5582106B3333ff Notice: Undefined variable: SUM in /in/1l4Af on line 10 <BR>5582106C3333ff