3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * This script will generate a pseudo IPv4 in Class E IP space (240.0.0.0 - 255.255.255.255) * for IPv6 users based on the 52 first bits of their IP. Class E address space is reserved * as experimental and no actual traffic should originate from it. * * @author NewEraCracker * @version 2.0.1 * @date 2014/07/03 * @license Public Domain */ var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('::'))); var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('::1'))); var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('::ffff'))); var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('ffff::1:0'))); var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('1::ffff:0'))); var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('1:2:3:4:5:6:7::'))); var_dump(NewEra_IPv6Hack::ip_unpack(NewEra_IPv6Hack::ip_pack('::2:3:4:5:6:7:8'))); class NewEra_IPv6Hack { /** @Link : http://php.net/manual/en/function.inet-pton.php */ public static function ip_pack($ip) { if(strpos($ip, '.') !== false) { // Pack IPv4 $ip = trim($ip, ':f'); $ip = pack('N', ip2long($ip)); return $ip; } elseif(strpos($ip, ':') !== false) { // Expand IPv6 $ip = self::ipv6_expand($ip); // Pack IPv6 $ip = pack('H'.strlen($ip), $ip); return $ip; } return false; } /** @Link : http://php.net/manual/en/function.inet-ntop.php */ public static function ip_unpack($ip) { if(strlen($ip) == 4) { // Unpack IPv4 list(, $ip) = unpack('N', $ip); $ip = long2ip($ip); return $ip; } elseif(strlen($ip) == 16) { // Unpack IPv6 $ip = bin2hex($ip); // Compact IPv6 $res = ''; for($i = strlen($ip); $i > 0; $i = ($i-4)) { $seg = substr($ip, $i-4, 4); $seg = ltrim($seg, '0'); if($seg != '') { $res = $seg.($res==''?'':':').$res; } else { if(strpos($res, '::') === false) { // Check iteration number to make sure ::1 case is handled if($res != '' && $res[0] == ':' && $i > 4) { continue; } $res = ':'.$res; continue; } $res = '0'.($res==''?'':':').$res; } } // Handle ::2:3:4:5:6:7:8 and 1:2:3:4:5:6:7:: cases if(substr_count($res, ':') == 8) { $res = str_replace('::', ':0:', $res); $res = trim($res, ':'); } return $res; } return false; } /** Expand an IPv6 address */ public static function ipv6_expand($ip) { $ip = explode(':', $ip); $res = ''; $expand = true; foreach($ip as $seg) { if($seg == '' && $expand) { // This will expand a compacted IPv6 $res .= str_pad('', (((8 - count($ip)) + 1) * 4), '0', STR_PAD_LEFT); // Only expand once, otherwise it will cause troubles with ::1 or ffff:: $expand = false; } else { // This will pad to ensure each IPv6 part has 4 digits. $res .= str_pad($seg, 4, '0', STR_PAD_LEFT); } } return $res; } /** Shift an IPv6 to right (IPv6 >> 1). This will be handy to generate a fake IPv4 */ public static function ipv6_shift_right($ip) { $ip = self::ipv6_expand($ip); $ip = substr($ip, -1).substr($ip, 0, -1); $ip = substr(chunk_split($ip, 4, ':'), 0, -1); return $ip; } /** Create a fake IPv4 address from a given IPv6 address */ public static function ipv6_to_ipv4($ip) { if(strpos($ip, ':') === false || strpos($ip, '.') !== false) { return false; } $ip = self::ipv6_shift_right($ip); $ip = self::ip_pack($ip); // First 8 bits of IPv4 will be: // - The last 4 bits of unshifted IPv6, all set to true via mask // - The first 4 bits of unshifted IPv6, all in their original state via mask // This ensures an IPv4 in Class E space (240.0.0.0 - 255.255.255.255) $ipv4 = chr(ord($ip[0]) | 0xf0); for($i=1;$i<7;$i+=2) { // Convert 48 bits of IPv6 in last 24 bits of IPv4 via XOR $ipv4 .= chr(ord($ip[$i]) ^ ord($ip[$i+1])); } return self::ip_unpack($ipv4); } /** Convert a V4overV6 to IPv4 */ public static function v4overv6_to_ipv4($ip) { if(strpos($ip, '.') !== false) { $ip = trim($ip, ':f'); return $ip; } return false; } /** This will test if it is a V4overV6 or an IPv6 and do the convertion */ public static function all_to_ipv4($ip) { $v4overv6_test = self::v4overv6_to_ipv4($ip); if($v4overv6_test !== false) { return $v4overv6_test; } return self::ipv6_to_ipv4($ip); } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5bAE0
function name:  (null)
number of ops:  64
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
          2        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
          3        SEND_VAL_EX                                              '%3A%3A'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR_NO_REF_EX                                       $0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
   14     9        INIT_FCALL                                               'var_dump'
         10        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
         11        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
         12        SEND_VAL_EX                                              '%3A%3A1'
         13        DO_FCALL                                      0  $3      
         14        SEND_VAR_NO_REF_EX                                       $3
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   15    18        INIT_FCALL                                               'var_dump'
         19        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
         20        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
         21        SEND_VAL_EX                                              '%3A%3Affff'
         22        DO_FCALL                                      0  $6      
         23        SEND_VAR_NO_REF_EX                                       $6
         24        DO_FCALL                                      0  $7      
         25        SEND_VAR                                                 $7
         26        DO_ICALL                                                 
   16    27        INIT_FCALL                                               'var_dump'
         28        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
         29        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
         30        SEND_VAL_EX                                              'ffff%3A%3A1%3A0'
         31        DO_FCALL                                      0  $9      
         32        SEND_VAR_NO_REF_EX                                       $9
         33        DO_FCALL                                      0  $10     
         34        SEND_VAR                                                 $10
         35        DO_ICALL                                                 
   17    36        INIT_FCALL                                               'var_dump'
         37        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
         38        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
         39        SEND_VAL_EX                                              '1%3A%3Affff%3A0'
         40        DO_FCALL                                      0  $12     
         41        SEND_VAR_NO_REF_EX                                       $12
         42        DO_FCALL                                      0  $13     
         43        SEND_VAR                                                 $13
         44        DO_ICALL                                                 
   18    45        INIT_FCALL                                               'var_dump'
         46        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
         47        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
         48        SEND_VAL_EX                                              '1%3A2%3A3%3A4%3A5%3A6%3A7%3A%3A'
         49        DO_FCALL                                      0  $15     
         50        SEND_VAR_NO_REF_EX                                       $15
         51        DO_FCALL                                      0  $16     
         52        SEND_VAR                                                 $16
         53        DO_ICALL                                                 
   19    54        INIT_FCALL                                               'var_dump'
         55        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_unpack'
         56        INIT_STATIC_METHOD_CALL                                  'NewEra_IPv6Hack', 'ip_pack'
         57        SEND_VAL_EX                                              '%3A%3A2%3A3%3A4%3A5%3A6%3A7%3A8'
         58        DO_FCALL                                      0  $18     
         59        SEND_VAR_NO_REF_EX                                       $18
         60        DO_FCALL                                      0  $19     
         61        SEND_VAR                                                 $19
         62        DO_ICALL                                                 
  190    63      > RETURN                                                   1

Class NewEra_IPv6Hack:
Function ip_pack:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 22
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 40
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5bAE0
function name:  ip_pack
number of ops:  42
compiled vars:  !0 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '.'
          4        DO_ICALL                                         $1      
          5        TYPE_CHECK                                  1018          $1
          6      > JMPZ                                                     ~2, ->22
   29     7    >   INIT_FCALL                                               'trim'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '%3Af'
         10        DO_ICALL                                         $3      
         11        ASSIGN                                                   !0, $3
   30    12        INIT_FCALL                                               'pack'
         13        SEND_VAL                                                 'N'
         14        INIT_FCALL                                               'ip2long'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $5      
         17        SEND_VAR                                                 $5
         18        DO_ICALL                                         $6      
         19        ASSIGN                                                   !0, $6
   32    20      > RETURN                                                   !0
         21*       JMP                                                      ->40
   34    22    >   INIT_FCALL                                               'strpos'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 '%3A'
         25        DO_ICALL                                         $8      
         26        TYPE_CHECK                                  1018          $8
         27      > JMPZ                                                     ~9, ->40
   37    28    >   INIT_STATIC_METHOD_CALL                                  'ipv6_expand'
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0  $10     
         31        ASSIGN                                                   !0, $10
   40    32        INIT_FCALL                                               'pack'
         33        STRLEN                                           ~12     !0
         34        CONCAT                                           ~13     'H', ~12
         35        SEND_VAL                                                 ~13
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $14     
         38        ASSIGN                                                   !0, $14
   42    39      > RETURN                                                   !0
   45    40    > > RETURN                                                   <false>
   46    41*     > RETURN                                                   null

End of function ip_pack

Function ip_unpack:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 100
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 28
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 99
Branch analysis from position: 88
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 99
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 51
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 28
Branch analysis from position: 82
Branch analysis from position: 28
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 70
Branch analysis from position: 57
2 jumps found. (Code = 46) Position 1 = 59, Position 2 = 62
Branch analysis from position: 59
2 jumps found. (Code = 46) Position 1 = 63, Position 2 = 65
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 67
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
Branch analysis from position: 65
Branch analysis from position: 62
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 74
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 28
Branch analysis from position: 82
Branch analysis from position: 28
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 28
Branch analysis from position: 82
Branch analysis from position: 28
Branch analysis from position: 100
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5bAE0
function name:  ip_unpack
number of ops:  102
compiled vars:  !0 = $ip, !1 = $res, !2 = $i, !3 = $seg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
   51     1        STRLEN                                           ~4      !0
          2        IS_EQUAL                                                 ~4, 4
          3      > JMPZ                                                     ~5, ->17
   54     4    >   INIT_FCALL                                               'unpack'
          5        SEND_VAL                                                 'N'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        FETCH_LIST_R                                     $7      $6, 1
          9        ASSIGN                                                   !0, $7
         10        FREE                                                     $6
   55    11        INIT_FCALL                                               'long2ip'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !0, $9
   57    15      > RETURN                                                   !0
         16*       JMP                                                      ->100
   59    17    >   STRLEN                                           ~11     !0
         18        IS_EQUAL                                                 ~11, 16
         19      > JMPZ                                                     ~12, ->100
   62    20    >   INIT_FCALL                                               'bin2hex'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $13     
         23        ASSIGN                                                   !0, $13
   65    24        ASSIGN                                                   !1, ''
   66    25        STRLEN                                           ~16     !0
         26        ASSIGN                                                   !2, ~16
         27      > JMP                                                      ->80
   68    28    >   INIT_FCALL                                               'substr'
         29        SEND_VAR                                                 !0
         30        SUB                                              ~18     !2, 4
         31        SEND_VAL                                                 ~18
         32        SEND_VAL                                                 4
         33        DO_ICALL                                         $19     
         34        ASSIGN                                                   !3, $19
   69    35        INIT_FCALL                                               'ltrim'
         36        SEND_VAR                                                 !3
         37        SEND_VAL                                                 '0'
         38        DO_ICALL                                         $21     
         39        ASSIGN                                                   !3, $21
   71    40        IS_NOT_EQUAL                                             !3, ''
         41      > JMPZ                                                     ~23, ->51
   73    42    >   IS_EQUAL                                                 !1, ''
         43      > JMPZ                                                     ~24, ->46
         44    >   QM_ASSIGN                                        ~25     ''
         45      > JMP                                                      ->47
         46    >   QM_ASSIGN                                        ~25     '%3A'
         47    >   CONCAT                                           ~26     !3, ~25
         48        CONCAT                                           ~27     ~26, !1
         49        ASSIGN                                                   !1, ~27
         50      > JMP                                                      ->78
   77    51    >   INIT_FCALL                                               'strpos'
         52        SEND_VAR                                                 !1
         53        SEND_VAL                                                 '%3A%3A'
         54        DO_ICALL                                         $29     
         55        TYPE_CHECK                                    4          $29
         56      > JMPZ                                                     ~30, ->70
   80    57    >   IS_NOT_EQUAL                                     ~31     !1, ''
         58      > JMPZ_EX                                          ~31     ~31, ->62
         59    >   FETCH_DIM_R                                      ~32     !1, 0
         60        IS_EQUAL                                         ~33     ~32, '%3A'
         61        BOOL                                             ~31     ~33
         62    > > JMPZ_EX                                          ~31     ~31, ->65
         63    >   IS_SMALLER                                       ~34     4, !2
         64        BOOL                                             ~31     ~34
         65    > > JMPZ                                                     ~31, ->67
   82    66    > > JMP                                                      ->78
   84    67    >   CONCAT                                           ~35     '%3A', !1
         68        ASSIGN                                                   !1, ~35
   85    69      > JMP                                                      ->78
   87    70    >   IS_EQUAL                                                 !1, ''
         71      > JMPZ                                                     ~37, ->74
         72    >   QM_ASSIGN                                        ~38     ''
         73      > JMP                                                      ->75
         74    >   QM_ASSIGN                                        ~38     '%3A'
         75    >   CONCAT                                           ~39     '0', ~38
         76        CONCAT                                           ~40     ~39, !1
         77        ASSIGN                                                   !1, ~40
   66    78    >   SUB                                              ~42     !2, 4
         79        ASSIGN                                                   !2, ~42
         80    >   IS_SMALLER                                               0, !2
         81      > JMPNZ                                                    ~44, ->28
   91    82    >   INIT_FCALL                                               'substr_count'
         83        SEND_VAR                                                 !1
         84        SEND_VAL                                                 '%3A'
         85        DO_ICALL                                         $45     
         86        IS_EQUAL                                                 $45, 8
         87      > JMPZ                                                     ~46, ->99
   93    88    >   INIT_FCALL                                               'str_replace'
         89        SEND_VAL                                                 '%3A%3A'
         90        SEND_VAL                                                 '%3A0%3A'
         91        SEND_VAR                                                 !1
         92        DO_ICALL                                         $47     
         93        ASSIGN                                                   !1, $47
   94    94        INIT_FCALL                                               'trim'
         95        SEND_VAR                                                 !1
         96        SEND_VAL                                                 '%3A'
         97        DO_ICALL                                         $49     
         98        ASSIGN                                                   !1, $49
   97    99    > > RETURN                                                   !1
  100   100    > > RETURN                                                   <false>
  101   101*     > RETURN                                                   null

End of function ip_unpack

Function ipv6_expand:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 35
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 35
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 27
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/5bAE0
function name:  ipv6_expand
number of ops:  38
compiled vars:  !0 = $ip, !1 = $res, !2 = $expand, !3 = $seg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  104     0  E >   RECV                                             !0      
  106     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%3A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
  107     6        ASSIGN                                                   !1, ''
  108     7        ASSIGN                                                   !2, <true>
  109     8      > FE_RESET_R                                       $8      !0, ->35
          9    > > FE_FETCH_R                                               $8, !3, ->35
  111    10    >   IS_EQUAL                                         ~9      !3, ''
         11      > JMPZ_EX                                          ~9      ~9, ->13
         12    >   BOOL                                             ~9      !2
         13    > > JMPZ                                                     ~9, ->27
  114    14    >   INIT_FCALL                                               'str_pad'
         15        SEND_VAL                                                 ''
         16        COUNT                                            ~10     !0
         17        SUB                                              ~11     8, ~10
         18        ADD                                              ~12     ~11, 1
         19        MUL                                              ~13     ~12, 4
         20        SEND_VAL                                                 ~13
         21        SEND_VAL                                                 '0'
         22        SEND_VAL                                                 0
         23        DO_ICALL                                         $14     
         24        ASSIGN_OP                                     8          !1, $14
  117    25        ASSIGN                                                   !2, <false>
         26      > JMP                                                      ->34
  122    27    >   INIT_FCALL                                               'str_pad'
         28        SEND_VAR                                                 !3
         29        SEND_VAL                                                 4
         30        SEND_VAL                                                 '0'
         31        SEND_VAL                                                 0
         32        DO_ICALL                                         $17     
         33        ASSIGN_OP                                     8          !1, $17
  109    34    > > JMP                                                      ->9
         35    >   FE_FREE                                                  $8
  126    36      > RETURN                                                   !1
  127    37*     > RETURN                                                   null

End of function ipv6_expand

Function ipv6_shift_right:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5bAE0
function name:  ipv6_shift_right
number of ops:  29
compiled vars:  !0 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  130     0  E >   RECV                                             !0      
  132     1        INIT_STATIC_METHOD_CALL                                  'ipv6_expand'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
  133     5        INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 -1
          8        DO_ICALL                                         $3      
          9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 -1
         13        DO_ICALL                                         $4      
         14        CONCAT                                           ~5      $3, $4
         15        ASSIGN                                                   !0, ~5
  134    16        INIT_FCALL                                               'substr'
         17        INIT_FCALL                                               'chunk_split'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 4
         20        SEND_VAL                                                 '%3A'
         21        DO_ICALL                                         $7      
         22        SEND_VAR                                                 $7
         23        SEND_VAL                                                 0
         24        SEND_VAL                                                 -1
         25        DO_ICALL                                         $8      
         26        ASSIGN                                                   !0, $8
  136    27      > RETURN                                                   !0
  137    28*     > RETURN                                                   null

End of function ipv6_shift_right

Function ipv6_to_ipv4:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 34
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 34
Branch analysis from position: 51
Branch analysis from position: 34
Branch analysis from position: 13
filename:       /in/5bAE0
function name:  ipv6_to_ipv4
number of ops:  56
compiled vars:  !0 = $ip, !1 = $ipv4, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  140     0  E >   RECV                                             !0      
  142     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3A'
          4        DO_ICALL                                         $3      
          5        TYPE_CHECK                                    4  ~4      $3
          6      > JMPNZ_EX                                         ~4      ~4, ->13
          7    >   INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '.'
         10        DO_ICALL                                         $5      
         11        TYPE_CHECK                                  1018  ~6      $5
         12        BOOL                                             ~4      ~6
         13    > > JMPZ                                                     ~4, ->15
  144    14    > > RETURN                                                   <false>
  147    15    >   INIT_STATIC_METHOD_CALL                                  'ipv6_shift_right'
         16        SEND_VAR                                                 !0
         17        DO_FCALL                                      0  $7      
         18        ASSIGN                                                   !0, $7
  148    19        INIT_STATIC_METHOD_CALL                                  'ip_pack'
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0  $9      
         22        ASSIGN                                                   !0, $9
  154    23        INIT_FCALL                                               'chr'
         24        INIT_FCALL                                               'ord'
         25        FETCH_DIM_R                                      ~11     !0, 0
         26        SEND_VAL                                                 ~11
         27        DO_ICALL                                         $12     
         28        BW_OR                                            ~13     $12, 240
         29        SEND_VAL                                                 ~13
         30        DO_ICALL                                         $14     
         31        ASSIGN                                                   !1, $14
  156    32        ASSIGN                                                   !2, 1
         33      > JMP                                                      ->49
  159    34    >   INIT_FCALL                                               'chr'
         35        INIT_FCALL                                               'ord'
         36        FETCH_DIM_R                                      ~17     !0, !2
         37        SEND_VAL                                                 ~17
         38        DO_ICALL                                         $18     
         39        INIT_FCALL                                               'ord'
         40        ADD                                              ~19     !2, 1
         41      

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.23 ms | 1428 KiB | 47 Q