3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = '0x8000000'; $data = substr($data, 2); //remove the 0x prefix from the string $data = str_replace(' ', '', $data); //remove the spaces from the string //$data is now '11210031' $number = hexdec($data); //convert the hexadecimal number to an integer //$number is now 0x11210031 (hexadecimal) = 287375409 (decimal) $nibble1 = ($number >> 28) & 0xF; //shift the number right by 28 bits (each nibble is 4 bits) and select only the last 4 bits (0xF selects all bits in the last nibble) echo "the product number is $nibble1\n"; $nibble2 = ($number >> 24) & 0xF; if ($nibble2 == 1) { echo "this is a new product\n"; } else if ($nibble2 == 2) { echo "this is a used product\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/T5R5E
function name:  (null)
number of ops:  34
compiled vars:  !0 = $data, !1 = $number, !2 = $nibble1, !3 = $nibble2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '0x8000000'
    4     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !0, $5
    5     6        INIT_FCALL                                               'str_replace'
          7        SEND_VAL                                                 '+'
          8        SEND_VAL                                                 ''
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !0, $7
    7    12        INIT_FCALL                                               'hexdec'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !1, $9
    9    16        SR                                               ~11     !1, 28
         17        BW_AND                                           ~12     ~11, 15
         18        ASSIGN                                                   !2, ~12
   10    19        ROPE_INIT                                     3  ~15     'the+product+number+is+'
         20        ROPE_ADD                                      1  ~15     ~15, !2
         21        ROPE_END                                      2  ~14     ~15, '%0A'
         22        ECHO                                                     ~14
   11    23        SR                                               ~17     !1, 24
         24        BW_AND                                           ~18     ~17, 15
         25        ASSIGN                                                   !3, ~18
   12    26        IS_EQUAL                                                 !3, 1
         27      > JMPZ                                                     ~20, ->30
   13    28    >   ECHO                                                     'this+is+a+new+product%0A'
         29      > JMP                                                      ->33
   14    30    >   IS_EQUAL                                                 !3, 2
         31      > JMPZ                                                     ~21, ->33
   15    32    >   ECHO                                                     'this+is+a+used+product%0A'
   16    33    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.39 ms | 1396 KiB | 19 Q