3v4l.org

run code in 300+ PHP versions simultaneously
<?php function domainGetFromURL($url, $strip_www = true) { echo parse_url($url); 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/sTI1p
function name:  (null)
number of ops:  7
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2F281654'
   29     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 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 32
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sTI1p
function name:  domainGetFromURL
number of ops:  39
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>
    6     2        INIT_FCALL                                               'parse_url'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ECHO                                                     $4
    9     6        BEGIN_SILENCE                                    ~5      
          7        INIT_FCALL                                               'parse_url'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $6      
         10        END_SILENCE                                              ~5
         11        ASSIGN                                           ~7      !2, $6
         12        BOOL_NOT                                         ~8      ~7
         13      > JMPZ                                                     ~8, ->15
   10    14    > > RETURN                                                   ''
   13    15    >   FETCH_DIM_R                                      ~9      !2, 'host'
         16        STRLEN                                           ~10     ~9
         17        IS_EQUAL                                                 ~10, 0
         18      > JMPZ                                                     ~11, ->20
   14    19    > > RETURN                                                   ''
   17    20    > > JMPZ                                                     !1, ->32
   18    21    >   INIT_FCALL                                               'preg_replace'
         22        SEND_VAL                                                 '%23%5Ewww%5C.%28www%5C.%29%2A%23'
         23        SEND_VAL                                                 ''
         24        INIT_FCALL                                               'strtolower'
         25        FETCH_DIM_R                                      ~12     !2, 'host'
         26        SEND_VAL                                                 ~12
         27        DO_ICALL                                         $13     
         28        SEND_VAR                                                 $13
         29        DO_ICALL                                         $14     
         30        ASSIGN                                                   !3, $14
         31      > JMP                                                      ->37
   20    32    >   INIT_FCALL                                               'strtolower'
         33        FETCH_DIM_R                                      ~16     !2, 'host'
         34        SEND_VAL                                                 ~16
         35        DO_ICALL                                         $17     
         36        ASSIGN                                                   !3, $17
   23    37    > > RETURN                                                   !3
   24    38*     > RETURN                                                   null

End of function domaingetfromurl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.42 ms | 1403 KiB | 20 Q