3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_list_ip($ip_addr_cidr){ $ip_arr = explode("/", $ip_addr_cidr); $bin = ""; for($i=1;$i<=32;$i++) { $bin .= $ip_arr[1] >= $i ? '1' : '0'; } $ip_arr[1] = bindec($bin); $ip = ip2long($ip_arr[0]); $nm = $ip_arr[1]; $nw = ($ip & $nm); $bc = $nw | ~$nm; $bc_long = ip2long(long2ip($bc)); echo "Number of Hosts: " . ($bc_long - $nw - 1) . "<br/>"; echo "Host Range: " . long2ip($nw + 1) . " -> " . long2ip($bc - 1) . "<br/>". "<br/>"; for($zm=1;($nw + $zm)<=($bc_long - 1);$zm++) { echo long2ip($nw + $zm). "<br/>"; } } get_list_ip('192.168.1.101/22');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hm5e1
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'get_list_ip'
          1        SEND_VAL                                                 '192.168.1.101%2F22'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function get_list_ip:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 9
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 64
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 64
Branch analysis from position: 75
Branch analysis from position: 64
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 9
Branch analysis from position: 19
Branch analysis from position: 9
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 9
Branch analysis from position: 19
Branch analysis from position: 9
filename:       /in/hm5e1
function name:  get_list_ip
number of ops:  76
compiled vars:  !0 = $ip_addr_cidr, !1 = $ip_arr, !2 = $bin, !3 = $i, !4 = $ip, !5 = $nm, !6 = $nw, !7 = $bc, !8 = $bc_long, !9 = $zm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !1, $10
    5     6        ASSIGN                                                   !2, ''
    7     7        ASSIGN                                                   !3, 1
          8      > JMP                                                      ->17
    8     9    >   FETCH_DIM_R                                      ~14     !1, 1
         10        IS_SMALLER_OR_EQUAL                                      !3, ~14
         11      > JMPZ                                                     ~15, ->14
         12    >   QM_ASSIGN                                        ~16     '1'
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~16     '0'
         15    >   ASSIGN_OP                                     8          !2, ~16
    7    16        PRE_INC                                                  !3
         17    >   IS_SMALLER_OR_EQUAL                                      !3, 32
         18      > JMPNZ                                                    ~19, ->9
   11    19    >   INIT_FCALL                                               'bindec'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $21     
         22        ASSIGN_DIM                                               !1, 1
         23        OP_DATA                                                  $21
   13    24        INIT_FCALL                                               'ip2long'
         25        FETCH_DIM_R                                      ~22     !1, 0
         26        SEND_VAL                                                 ~22
         27        DO_ICALL                                         $23     
         28        ASSIGN                                                   !4, $23
   14    29        FETCH_DIM_R                                      ~25     !1, 1
         30        ASSIGN                                                   !5, ~25
   15    31        BW_AND                                           ~27     !4, !5
         32        ASSIGN                                                   !6, ~27
   16    33        BW_NOT                                           ~29     !5
         34        BW_OR                                            ~30     !6, ~29
         35        ASSIGN                                                   !7, ~30
   17    36        INIT_FCALL                                               'ip2long'
         37        INIT_FCALL                                               'long2ip'
         38        SEND_VAR                                                 !7
         39        DO_ICALL                                         $32     
         40        SEND_VAR                                                 $32
         41        DO_ICALL                                         $33     
         42        ASSIGN                                                   !8, $33
   19    43        SUB                                              ~35     !8, !6
         44        SUB                                              ~36     ~35, 1
         45        CONCAT                                           ~37     'Number+of+Hosts%3A++++', ~36
         46        CONCAT                                           ~38     ~37, '%3Cbr%2F%3E'
         47        ECHO                                                     ~38
   20    48        INIT_FCALL                                               'long2ip'
         49        ADD                                              ~39     !6, 1
         50        SEND_VAL                                                 ~39
         51        DO_ICALL                                         $40     
         52        CONCAT                                           ~41     'Host+Range%3A+++++++++', $40
         53        CONCAT                                           ~42     ~41, '+-%3E+'
         54        INIT_FCALL                                               'long2ip'
         55        SUB                                              ~43     !7, 1
         56        SEND_VAL                                                 ~43
         57        DO_ICALL                                         $44     
         58        CONCAT                                           ~45     ~42, $44
         59        CONCAT                                           ~46     ~45, '%3Cbr%2F%3E'
         60        CONCAT                                           ~47     ~46, '%3Cbr%2F%3E'
         61        ECHO                                                     ~47
   22    62        ASSIGN                                                   !9, 1
         63      > JMP                                                      ->71
   24    64    >   INIT_FCALL                                               'long2ip'
         65        ADD                                              ~49     !6, !9
         66        SEND_VAL                                                 ~49
         67        DO_ICALL                                         $50     
         68        CONCAT                                           ~51     $50, '%3Cbr%2F%3E'
         69        ECHO                                                     ~51
   22    70        PRE_INC                                                  !9
         71    >   ADD                                              ~53     !6, !9
         72        SUB                                              ~54     !8, 1
         73        IS_SMALLER_OR_EQUAL                                      ~53, ~54
         74      > JMPNZ                                                    ~55, ->64
   26    75    > > RETURN                                                   null

End of function get_list_ip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.46 ms | 1407 KiB | 22 Q