3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Используется так: function net_match ( $network , $ip ) { $ip_arr = explode ( '/' , $network ); $network_long = ip2long ( $ip_arr [ 0 ]); $x = ip2long ( $ip_arr [ 1 ]); $mask = long2ip ( $x ) == $ip_arr [ 1 ] ? $x : 2^( 32 - $ip_arr [ 1 ]); $ip_long = ip2long ( $ip ); echo ">".$ip_arr[1]."> ".decbin($mask)."\n"; return ( $ip_long & $mask ) == ( $network_long & $mask ); } echo net_match ( '192.168.0.0/2', '192.168.0.15' );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IjlE3
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'net_match'
          1        SEND_VAL                                                 '192.168.0.0%2F2'
          2        SEND_VAL                                                 '192.168.0.15'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function net_match:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IjlE3
function name:  net_match
number of ops:  48
compiled vars:  !0 = $network, !1 = $ip, !2 = $ip_arr, !3 = $network_long, !4 = $x, !5 = $mask, !6 = $ip_long
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2F'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
    7     7        INIT_FCALL                                               'ip2long'
          8        FETCH_DIM_R                                      ~9      !2, 0
          9        SEND_VAL                                                 ~9
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !3, $10
    9    12        INIT_FCALL                                               'ip2long'
         13        FETCH_DIM_R                                      ~12     !2, 1
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !4, $13
   10    17        INIT_FCALL                                               'long2ip'
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $15     
         20        FETCH_DIM_R                                      ~16     !2, 1
         21        IS_EQUAL                                                 $15, ~16
         22      > JMPZ                                                     ~17, ->25
         23    >   QM_ASSIGN                                        ~18     !4
         24      > JMP                                                      ->29
         25    >   FETCH_DIM_R                                      ~19     !2, 1
         26        SUB                                              ~20     32, ~19
         27        BW_XOR                                           ~21     ~20, 2
         28        QM_ASSIGN                                        ~18     ~21
         29    >   ASSIGN                                                   !5, ~18
   11    30        INIT_FCALL                                               'ip2long'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !6, $23
   13    34        FETCH_DIM_R                                      ~25     !2, 1
         35        CONCAT                                           ~26     '%3E', ~25
         36        CONCAT                                           ~27     ~26, '%3E+'
         37        INIT_FCALL                                               'decbin'
         38        SEND_VAR                                                 !5
         39        DO_ICALL                                         $28     
         40        CONCAT                                           ~29     ~27, $28
         41        CONCAT                                           ~30     ~29, '%0A'
         42        ECHO                                                     ~30
   14    43        BW_AND                                           ~31     !6, !5
         44        BW_AND                                           ~32     !3, !5
         45        IS_EQUAL                                         ~33     ~31, ~32
         46      > RETURN                                                   ~33
   15    47*     > RETURN                                                   null

End of function net_match

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.38 ms | 1402 KiB | 22 Q