3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getIPStringForFullDNS($ip, $class) { $limits = array('A' => -3, 'B' => -2, 'C' => -1, 'D' => 0); $limit = $limits[$class]; $ip = implode('.', explode('.', $ip, $limit)); $ip .= str_repeat('.*', abs($limit)); return $ip; } echo getIPStringForFullDNS('158.58.169.254', 'A') . "\n"; echo getIPStringForFullDNS('158.58.169.254', 'B') . "\n"; echo getIPStringForFullDNS('158.58.169.254', 'C') . "\n"; echo getIPStringForFullDNS('158.58.169.254', 'D') . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rsdIh
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'getipstringforfulldns'
          1        SEND_VAL                                                 '158.58.169.254'
          2        SEND_VAL                                                 'A'
          3        DO_FCALL                                      0  $0      
          4        CONCAT                                           ~1      $0, '%0A'
          5        ECHO                                                     ~1
   15     6        INIT_FCALL                                               'getipstringforfulldns'
          7        SEND_VAL                                                 '158.58.169.254'
          8        SEND_VAL                                                 'B'
          9        DO_FCALL                                      0  $2      
         10        CONCAT                                           ~3      $2, '%0A'
         11        ECHO                                                     ~3
   16    12        INIT_FCALL                                               'getipstringforfulldns'
         13        SEND_VAL                                                 '158.58.169.254'
         14        SEND_VAL                                                 'C'
         15        DO_FCALL                                      0  $4      
         16        CONCAT                                           ~5      $4, '%0A'
         17        ECHO                                                     ~5
   17    18        INIT_FCALL                                               'getipstringforfulldns'
         19        SEND_VAL                                                 '158.58.169.254'
         20        SEND_VAL                                                 'D'
         21        DO_FCALL                                      0  $6      
         22        CONCAT                                           ~7      $6, '%0A'
         23        ECHO                                                     ~7
         24      > RETURN                                                   1

Function getipstringforfulldns:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rsdIh
function name:  getIPStringForFullDNS
number of ops:  25
compiled vars:  !0 = $ip, !1 = $class, !2 = $limits, !3 = $limit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3        FETCH_DIM_R                                      ~5      !2, !1
          4        ASSIGN                                                   !3, ~5
    7     5        INIT_FCALL                                               'implode'
          6        SEND_VAL                                                 '.'
          7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '.'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14        ASSIGN                                                   !0, $8
    8    15        INIT_FCALL                                               'str_repeat'
         16        SEND_VAL                                                 '.%2A'
         17        INIT_FCALL                                               'abs'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                         $11     
         22        ASSIGN_OP                                     8          !0, $11
   10    23      > RETURN                                                   !0
   11    24*     > RETURN                                                   null

End of function getipstringforfulldns

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.79 ms | 1403 KiB | 25 Q