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; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/WmQvJ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $LstIA, !1 = $addr, !2 = $value, !3 = $DXPcmd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   21     1      > FE_RESET_RW                                      $5      !0, ->15
          2    > > FE_FETCH_RW                                              $5, !1, ->15
   22     3    >   MUL                                              ~6      !1, 2
          4        ASSIGN                                                   !2, ~6
   23     5        CONCAT                                           ~8      '%2455%2C%2482%2C%2410%2C%24', !1
          6        CONCAT                                           ~9      ~8, '%2C%2433%2C%2433'
          7        ASSIGN                                                   !3, ~9
   24     8        INIT_FCALL                                               'checksumcalculation'
          9        SEND_VAR                                                 !3
         10        DO_FCALL                                      0  $11     
         11        ASSIGN_OP                                     8          !3, $11
   25    12        CONCAT                                           ~13     '%3CBR%3E', !3
         13        ECHO                                                     ~13
   21    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $5
   28    16      > RETURN                                                   1

Function checksumcalculation:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 4
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 4
Branch analysis from position: 17
Branch analysis from position: 4
filename:       /in/WmQvJ
function name:  CheckSumCalculation
number of ops:  29
compiled vars:  !0 = $hex, !1 = $dsum, !2 = $i, !3 = $NotSum, !4 = $ChkSum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, 0
    9     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->13
   10     4    >   INIT_FCALL                                               'hexdec'
          5        FETCH_DIM_R                                      ~7      !0, !2
          6        ADD                                              ~8      !2, 1
          7        FETCH_DIM_R                                      ~9      !0, ~8
          8        CONCAT                                           ~10     ~7, ~9
          9        SEND_VAL                                                 ~10
         10        DO_ICALL                                         $11     
         11        ASSIGN_OP                                     1          !1, $11
    9    12        ASSIGN_OP                                     1          !2, 4
         13    >   STRLEN                                           ~14     !0
         14        SUB                                              ~15     ~14, 1
         15        IS_SMALLER                                               !2, ~15
         16      > JMPNZ                                                    ~16, ->4
   12    17    >   BW_NOT                                           ~17     !1
         18        ASSIGN                                                   !3, ~17
   13    19        INIT_FCALL                                               'substr'
         20        INIT_FCALL                                               'dechex'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $19     
         23        SEND_VAR                                                 $19
         24        SEND_VAL                                                 -2
         25        DO_ICALL                                         $20     
         26        ASSIGN                                                   !4, $20
   15    27      > RETURN                                                   !4
   16    28*     > RETURN                                                   null

End of function checksumcalculation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
236.69 ms | 1403 KiB | 20 Q