3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); function ip6ptrtoip6($arpa) { $mainptr = substr($arpa, 0, strlen($arpa)-9); $pieces = array_reverse(explode(".",$mainptr)); $count=count($pieces); $hex = implode("",$pieces); $hex=str_pad($hex,32,'0'); $ipbin = pack('H*', $hex); $ipv6addr = inet_ntop($ipbin); if($count<32) { $ipv6addr .= '0/' . $count*4; } // dump_nice essentially captures the output of var_dump into a string so I can // at the bottom of the page. var_dump(array($arpa,$hex,error_get_last(),$ipv6addr)); return $ipv6addr; } ip6ptrtoip6("0.7.1.2.2.0.a.2.ip6.arpa");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hteZr
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   23     3        INIT_FCALL                                               'ip6ptrtoip6'
          4        SEND_VAL                                                 '0.7.1.2.2.0.a.2.ip6.arpa'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function ip6ptrtoip6:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 44
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/hteZr
function name:  ip6ptrtoip6
number of ops:  55
compiled vars:  !0 = $arpa, !1 = $mainptr, !2 = $pieces, !3 = $count, !4 = $hex, !5 = $ipbin, !6 = $ipv6addr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        STRLEN                                           ~7      !0
          5        SUB                                              ~8      ~7, 9
          6        SEND_VAL                                                 ~8
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !1, $9
    6     9        INIT_FCALL                                               'array_reverse'
         10        INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '.'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $11     
         14        SEND_VAR                                                 $11
         15        DO_ICALL                                         $12     
         16        ASSIGN                                                   !2, $12
    7    17        COUNT                                            ~14     !2
         18        ASSIGN                                                   !3, ~14
    9    19        INIT_FCALL                                               'implode'
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !4, $16
   10    24        INIT_FCALL                                               'str_pad'
         25        SEND_VAR                                                 !4
         26        SEND_VAL                                                 32
         27        SEND_VAL                                                 '0'
         28        DO_ICALL                                         $18     
         29        ASSIGN                                                   !4, $18
   11    30        INIT_FCALL                                               'pack'
         31        SEND_VAL                                                 'H%2A'
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                         $20     
         34        ASSIGN                                                   !5, $20
   12    35        INIT_FCALL                                               'inet_ntop'
         36        SEND_VAR                                                 !5
         37        DO_ICALL                                         $22     
         38        ASSIGN                                                   !6, $22
   13    39        IS_SMALLER                                               !3, 32
         40      > JMPZ                                                     ~24, ->44
   14    41    >   MUL                                              ~25     !3, 4
         42        CONCAT                                           ~26     '0%2F', ~25
         43        ASSIGN_OP                                     8          !6, ~26
   18    44    >   INIT_FCALL                                               'var_dump'
         45        INIT_ARRAY                                       ~28     !0
         46        ADD_ARRAY_ELEMENT                                ~28     !4
         47        INIT_FCALL                                               'error_get_last'
         48        DO_ICALL                                         $29     
         49        ADD_ARRAY_ELEMENT                                ~28     $29
         50        ADD_ARRAY_ELEMENT                                ~28     !6
         51        SEND_VAL                                                 ~28
         52        DO_ICALL                                                 
   20    53      > RETURN                                                   !6
   21    54*     > RETURN                                                   null

End of function ip6ptrtoip6

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.15 ms | 1403 KiB | 34 Q