3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getRange($ip) { $split = explode('.',$ip); $final = array(); foreach ($split as $block) { $pos = strpos($block, '*'); if ($pos !== false) { $num = substr($block, 0, $pos); $l = strlen($block); $min = (int) str_pad($num,3,'0'); $max = (int) min(255,str_pad($num,3,'9')); $minip = $final; $minip[] = $min; $minip = array_pad($minip, 4, 0); $maxip = $final; $maxip[] = $max; $maxip = array_pad($maxip, 4, 255); return array(implode('.',$minip),implode('.',$maxip)); } $final[] = $block; } return array(implode('.',$final),implode('.',$final)); // No range found. } print_R(getRange("255.55.0.1"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i9I2Q
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'getrange'
          2        SEND_VAL                                                 '255.55.0.1'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function getrange:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 75
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 75
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 72
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
filename:       /in/i9I2Q
function name:  getRange
number of ops:  88
compiled vars:  !0 = $ip, !1 = $split, !2 = $final, !3 = $block, !4 = $pos, !5 = $num, !6 = $l, !7 = $min, !8 = $max, !9 = $minip, !10 = $maxip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $11     
          5        ASSIGN                                                   !1, $11
    4     6        ASSIGN                                                   !2, <array>
    5     7      > FE_RESET_R                                       $14     !1, ->75
          8    > > FE_FETCH_R                                               $14, !3, ->75
    6     9    >   INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !3
         11        SEND_VAL                                                 '%2A'
         12        DO_ICALL                                         $15     
         13        ASSIGN                                                   !4, $15
    7    14        TYPE_CHECK                                  1018          !4
         15      > JMPZ                                                     ~17, ->72
    8    16    >   INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !3
         18        SEND_VAL                                                 0
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !5, $18
    9    22        STRLEN                                           ~20     !3
         23        ASSIGN                                                   !6, ~20
   10    24        INIT_FCALL                                               'str_pad'
         25        SEND_VAR                                                 !5
         26        SEND_VAL                                                 3
         27        SEND_VAL                                                 '0'
         28        DO_ICALL                                         $22     
         29        CAST                                          4  ~23     $22
         30        ASSIGN                                                   !7, ~23
   11    31        INIT_FCALL                                               'min'
         32        SEND_VAL                                                 255
         33        INIT_FCALL                                               'str_pad'
         34        SEND_VAR                                                 !5
         35        SEND_VAL                                                 3
         36        SEND_VAL                                                 '9'
         37        DO_ICALL                                         $25     
         38        SEND_VAR                                                 $25
         39        DO_ICALL                                         $26     
         40        CAST                                          4  ~27     $26
         41        ASSIGN                                                   !8, ~27
   13    42        ASSIGN                                                   !9, !2
   14    43        ASSIGN_DIM                                               !9
         44        OP_DATA                                                  !7
   15    45        INIT_FCALL                                               'array_pad'
         46        SEND_VAR                                                 !9
         47        SEND_VAL                                                 4
         48        SEND_VAL                                                 0
         49        DO_ICALL                                         $31     
         50        ASSIGN                                                   !9, $31
   17    51        ASSIGN                                                   !10, !2
   18    52        ASSIGN_DIM                                               !10
         53        OP_DATA                                                  !8
   19    54        INIT_FCALL                                               'array_pad'
         55        SEND_VAR                                                 !10
         56        SEND_VAL                                                 4
         57        SEND_VAL                                                 255
         58        DO_ICALL                                         $35     
         59        ASSIGN                                                   !10, $35
   21    60        INIT_FCALL                                               'implode'
         61        SEND_VAL                                                 '.'
         62        SEND_VAR                                                 !9
         63        DO_ICALL                                         $37     
         64        INIT_ARRAY                                       ~38     $37
         65        INIT_FCALL                                               'implode'
         66        SEND_VAL                                                 '.'
         67        SEND_VAR                                                 !10
         68        DO_ICALL                                         $39     
         69        ADD_ARRAY_ELEMENT                                ~38     $39
         70        FE_FREE                                                  $14
         71      > RETURN                                                   ~38
   23    72    >   ASSIGN_DIM                                               !2
         73        OP_DATA                                                  !3
    5    74      > JMP                                                      ->8
         75    >   FE_FREE                                                  $14
   25    76        INIT_FCALL                                               'implode'
         77        SEND_VAL                                                 '.'
         78        SEND_VAR                                                 !2
         79        DO_ICALL                                         $41     
         80        INIT_ARRAY                                       ~42     $41
         81        INIT_FCALL                                               'implode'
         82        SEND_VAL                                                 '.'
         83        SEND_VAR                                                 !2
         84        DO_ICALL                                         $43     
         85        ADD_ARRAY_ELEMENT                                ~42     $43
         86      > RETURN                                                   ~42
   26    87*     > RETURN                                                   null

End of function getrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.3 ms | 1407 KiB | 30 Q