3v4l.org

run code in 300+ PHP versions simultaneously
<?php function domainGetFromURL($url, $strip_www = true) { if (!$p = @parse_url($url)) { return ''; } if (strlen($p['host']) == 0) { return ''; } if ($strip_www) { $domain = preg_replace('#^www\.(www\.)*#', '', strtolower($p['host'])); } else { $domain = strtolower($p['host']); } return $domain; } $url = 'http://281654'; echo domainGetFromURL($url, false);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lHdZ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2F281654'
   25     1        INIT_FCALL                                               'domaingetfromurl'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <false>
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function domaingetfromurl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 28
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lHdZ
function name:  domainGetFromURL
number of ops:  35
compiled vars:  !0 = $url, !1 = $strip_www, !2 = $p, !3 = $domain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
    5     2        BEGIN_SILENCE                                    ~4      
          3        INIT_FCALL                                               'parse_url'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        END_SILENCE                                              ~4
          7        ASSIGN                                           ~6      !2, $5
          8        BOOL_NOT                                         ~7      ~6
          9      > JMPZ                                                     ~7, ->11
    6    10    > > RETURN                                                   ''
    9    11    >   FETCH_DIM_R                                      ~8      !2, 'host'
         12        STRLEN                                           ~9      ~8
         13        IS_EQUAL                                                 ~9, 0
         14      > JMPZ                                                     ~10, ->16
   10    15    > > RETURN                                                   ''
   13    16    > > JMPZ                                                     !1, ->28
   14    17    >   INIT_FCALL                                               'preg_replace'
         18        SEND_VAL                                                 '%23%5Ewww%5C.%28www%5C.%29%2A%23'
         19        SEND_VAL                                                 ''
         20        INIT_FCALL                                               'strtolower'
         21        FETCH_DIM_R                                      ~11     !2, 'host'
         22        SEND_VAL                                                 ~11
         23        DO_ICALL                                         $12     
         24        SEND_VAR                                                 $12
         25        DO_ICALL                                         $13     
         26        ASSIGN                                                   !3, $13
         27      > JMP                                                      ->33
   16    28    >   INIT_FCALL                                               'strtolower'
         29        FETCH_DIM_R                                      ~15     !2, 'host'
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                         $16     
         32        ASSIGN                                                   !3, $16
   19    33    > > RETURN                                                   !3
   20    34*     > RETURN                                                   null

End of function domaingetfromurl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.59 ms | 1407 KiB | 20 Q