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('oxadmin.pr.citeeze.com'); var_export($subDomains); echo "\n"; $queryPart = $q = "SELECT modifiers m" . " FROM delivery_host_modifiers" . " WHERE host IN ('" . implode("','", $subDomains) . "')" . " ORDER BY LENGTH(host) " ; var_export($queryPart); $result = json_decode('[{ "id": 78852, "domain": "local.dev.citeeze.com", "categories": null, "added": "2014-12-04 06:35:38", "updated": "2014-12-10 21:23:34", "visible": 1, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 89652, "domain": "www.citeeze.com", "categories": null, "added": "2014-12-04 06:47:25", "updated": "2014-12-10 21:29:10", "visible": 1, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 356163, "domain": "citeeze.com", "categories": null, "added": "2015-01-20 13:42:50", "updated": "2015-01-20 13:42:50", "visible": 1, "user_added": 1, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 2739296, "domain": "dev.citeeze.com", "categories": null, "added": "2016-04-18 05:11:23", "updated": "2016-04-18 05:11:23", "visible": 0, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 4399187, "domain": "adunit.brendan.citeeze.com", "categories": null, "added": "2016-08-08 17:26:26", "updated": "2016-08-08 17:26:26", "visible": 1, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 5862092, "domain": "tools.brendan.citeeze.com", "categories": null, "added": "2016-09-19 21:22:07", "updated": "2016-09-19 21:22:07", "visible": 1, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 6335525, "domain": "oxadmin.pr.citeeze.com", "categories": null, "added": "2017-01-09 16:53:54", "updated": "2017-01-09 16:53:54", "visible": 0, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 6335537, "domain": "pr.citeeze.com", "categories": "", "added": "2017-07-11 12:53:18", "updated": "2017-07-11 12:53:25", "visible": 0, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 }, { "id": 6335540, "domain": "test.oxadmin.prciteeze.com", "categories": null, "added": "2017-07-11 11:56:42", "updated": "2017-07-11 11:56:42", "visible": 0, "user_added": 0, "mobile": 0, "requests": 0, "completion": 0.00 } ]'); var_dump($result, false);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GvCld
function name:  (null)
number of ops:  29
compiled vars:  !0 = $subDomains, !1 = $queryPart, !2 = $q, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'getallsubdomain'
          1        SEND_VAL                                                 'oxadmin.pr.citeeze.com'
          2        DO_FCALL                                      0  $4      
          3        ASSIGN                                                   !0, $4
   29     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7        ECHO                                                     '%0A'
   34     8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%27%2C%27'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12        CONCAT                                           ~8      'SELECT+modifiers+m+FROM+delivery_host_modifiers+WHERE+host+IN+%28%27', $7
         13        CONCAT                                           ~9      ~8, '%27%29'
   35    14        CONCAT                                           ~10     ~9, '+ORDER+BY+LENGTH%28host%29+'
   32    15        ASSIGN                                           ~11     !2, ~10
         16        ASSIGN                                                   !1, ~11
   37    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   40    20        INIT_FCALL                                               'json_decode'
         21        SEND_VAL                                                 '%5B%7B%0A++%22id%22%3A+78852%2C%0A++%22domain%22%3A+%22local.dev.citeeze.com%22%2C%0A++%22categories%22%3A+null%2C%0A++%22added%22%3A+%222014-12-04+06%3A35%3A38%22%2C%0A++%22updated%22%3A+%222014-12-10+21%3A23%3A34%22%2C%0A++%22visible%22%3A+1%2C%0A++%22user_added%22%3A+0%2C%0A++%22mobile%22%3A+0%2C%0A++%22requests%22%3A+0%2C%0A++%22completion%22%3A+0.00%0A%7D%2C%0A++%7B%0A++++%22id%22%3A+89652%2C%0A++++%22domain%22%3A+%22www.citeeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222014-12-04+06%3A47%3A25%22%2C%0A++++%22updated%22%3A+%222014-12-10+21%3A29%3A10%22%2C%0A++++%22visible%22%3A+1%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+356163%2C%0A++++%22domain%22%3A+%22citeeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222015-01-20+13%3A42%3A50%22%2C%0A++++%22updated%22%3A+%222015-01-20+13%3A42%3A50%22%2C%0A++++%22visible%22%3A+1%2C%0A++++%22user_added%22%3A+1%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+2739296%2C%0A++++%22domain%22%3A+%22dev.citeeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222016-04-18+05%3A11%3A23%22%2C%0A++++%22updated%22%3A+%222016-04-18+05%3A11%3A23%22%2C%0A++++%22visible%22%3A+0%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+4399187%2C%0A++++%22domain%22%3A+%22adunit.brendan.citeeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222016-08-08+17%3A26%3A26%22%2C%0A++++%22updated%22%3A+%222016-08-08+17%3A26%3A26%22%2C%0A++++%22visible%22%3A+1%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+5862092%2C%0A++++%22domain%22%3A+%22tools.brendan.citeeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222016-09-19+21%3A22%3A07%22%2C%0A++++%22updated%22%3A+%222016-09-19+21%3A22%3A07%22%2C%0A++++%22visible%22%3A+1%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+6335525%2C%0A++++%22domain%22%3A+%22oxadmin.pr.citeeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222017-01-09+16%3A53%3A54%22%2C%0A++++%22updated%22%3A+%222017-01-09+16%3A53%3A54%22%2C%0A++++%22visible%22%3A+0%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+6335537%2C%0A++++%22domain%22%3A+%22pr.citeeze.com%22%2C%0A++++%22categories%22%3A+%22%22%2C%0A++++%22added%22%3A+%222017-07-11+12%3A53%3A18%22%2C%0A++++%22updated%22%3A+%222017-07-11+12%3A53%3A25%22%2C%0A++++%22visible%22%3A+0%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%2C%0A++%7B%0A++++%22id%22%3A+6335540%2C%0A++++%22domain%22%3A+%22test.oxadmin.prciteeze.com%22%2C%0A++++%22categories%22%3A+null%2C%0A++++%22added%22%3A+%222017-07-11+11%3A56%3A42%22%2C%0A++++%22updated%22%3A+%222017-07-11+11%3A56%3A42%22%2C%0A++++%22visible%22%3A+0%2C%0A++++%22user_added%22%3A+0%2C%0A++++%22mobile%22%3A+0%2C%0A++++%22requests%22%3A+0%2C%0A++++%22completion%22%3A+0.00%0A++%7D%0A%5D'
         22        DO_ICALL                                         $14     
         23        ASSIGN                                                   !3, $14
  150    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !3
         26        SEND_VAL                                                 <false>
         27        DO_ICALL                                                 
         28      > 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/GvCld
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:
146.35 ms | 1407 KiB | 32 Q