3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Returns list of subdomains * @param string $domain * @return array */ function getAllSubDomain($domain) { //strip '<prefix>:' first $dpos = strpos($domain, ':'); if ($dpos !== false) { $domain = substr($domain, $dpos+1); } else { $domain = $domain; } $domainParts = explode('.', str_replace("'", '', $domain)); $ret = array(); for ($off = sizeof($domainParts) -1; $off >= 0; $off--) { $ret[] = implode('.', array_slice($domainParts, $off)); } return $ret; } $subDomains = getAllSubdomain('test.sub.domain.com'); var_export($subDomains); $queryPart = $q = "SELECT modifiers m" . " FROM delivery_host_modifiers" . " WHERE host IN ('" . implode("','", $subDomains) . "')" . " ORDER BY LENGTH(host) " ; var_export($queryPart);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y2hUd
function name:  (null)
number of ops:  20
compiled vars:  !0 = $subDomains, !1 = $queryPart, !2 = $q
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'getallsubdomain'
          1        SEND_VAL                                                 'test.sub.domain.com'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !0, $3
   29     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   34     7        INIT_FCALL                                               'implode'
          8        SEND_VAL                                                 '%27%2C%27'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11        CONCAT                                           ~7      'SELECT+modifiers+m+FROM+delivery_host_modifiers+WHERE+host+IN+%28%27', $6
         12        CONCAT                                           ~8      ~7, '%27%29'
   35    13        CONCAT                                           ~9      ~8, '+ORDER+BY+LENGTH%28host%29+'
   32    14        ASSIGN                                           ~10     !2, ~9
         15        ASSIGN                                                   !1, ~10
   37    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function getallsubdomain:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 31
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 31
Branch analysis from position: 44
Branch analysis from position: 31
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
filename:       /in/Y2hUd
function name:  getAllSubDomain
number of ops:  46
compiled vars:  !0 = $domain, !1 = $dpos, !2 = $domainParts, !3 = $ret, !4 = $off
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3A'
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   12     6        TYPE_CHECK                                  1018          !1
          7      > JMPZ                                                     ~7, ->15
   13     8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        ADD                                              ~8      !1, 1
         11        SEND_VAL                                                 ~8
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !0, $9
         14      > JMP                                                      ->16
   15    15    >   ASSIGN                                                   !0, !0
   18    16    >   INIT_FCALL                                               'explode'
         17        SEND_VAL                                                 '.'
         18        INIT_FCALL                                               'str_replace'
         19        SEND_VAL                                                 '%27'
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $12     
         23        SEND_VAR                                                 $12
         24        DO_ICALL                                         $13     
         25        ASSIGN                                                   !2, $13
   20    26        ASSIGN                                                   !3, <array>
   21    27        COUNT                                            ~16     !2
         28        SUB                                              ~17     ~16, 1
         29        ASSIGN                                                   !4, ~17
         30      > JMP                                                      ->42
   22    31    >   INIT_FCALL                                               'implode'
         32        SEND_VAL                                                 '.'
         33        INIT_FCALL                                               'array_slice'
         34        SEND_VAR                                                 !2
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                         $20     
         37        SEND_VAR                                                 $20
         38        DO_ICALL                                         $21     
         39        ASSIGN_DIM                                               !3
         40        OP_DATA                                                  $21
   21    41        PRE_DEC                                                  !4
         42    >   IS_SMALLER_OR_EQUAL                                      0, !4
         43      > JMPNZ                                                    ~23, ->31
   25    44    > > RETURN                                                   !3
   26    45*     > RETURN                                                   null

End of function getallsubdomain

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.19 ms | 1403 KiB | 28 Q