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 " . Model_DeliveryHostModifiers::tableName() . "" . " 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/T5MgH
function name:  (null)
number of ops:  25
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                                                 
   33     7        INIT_STATIC_METHOD_CALL                                  'Model_DeliveryHostModifiers', 'tableName'
          8        DO_FCALL                                      0  $6      
          9        CONCAT                                           ~7      'SELECT+modifiers+m+FROM+', $6
         10        CONCAT                                           ~8      ~7, ''
   34    11        CONCAT                                           ~9      ~8, '+WHERE+host+IN+%28%27'
         12        INIT_FCALL                                               'implode'
         13        SEND_VAL                                                 '%27%2C%27'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $10     
         16        CONCAT                                           ~11     ~9, $10
         17        CONCAT                                           ~12     ~11, '%27%29'
   35    18        CONCAT                                           ~13     ~12, '+ORDER+BY+LENGTH%28host%29+'
   32    19        ASSIGN                                           ~14     !2, ~13
         20        ASSIGN                                                   !1, ~14
   37    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > 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/T5MgH
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:
152.73 ms | 1403 KiB | 28 Q