3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print get_domain("http://somedomain.co.uk"); // outputs 'somedomain.co.uk' function get_domain($url) { $pieces = parse_url($url); $domain = isset($pieces['host']) ? $pieces['host'] : ''; if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) { return $regs['domain']; } return false; }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/8TJU9
function name:  (null)
number of ops:  6
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   INIT_FCALL_BY_NAME                                       'get_domain'
         1        SEND_VAL_EX                                              'http%3A%2F%2Fsomedomain.co.uk'
         2        DO_FCALL                                      0  $0      
         3        ECHO                                                     $0
   4     4        NOP                                                      
  12     5      > RETURN                                                   1

Function get_domain:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
Jump found. Position 1 = 11
Branch analysis from position: 11
Jump found. Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
Jump found. Position 1 = -2
Branch analysis from position: 20
Jump found. Position 1 = -2
Branch analysis from position: 10
Jump found. Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
Branch analysis from position: 20
filename:       /in/8TJU9
function name:  get_domain
number of ops:  22
compiled vars:  !0 = $url, !1 = $pieces, !2 = $domain, !3 = $regs
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   RECV                                             !0      
   6     1        INIT_FCALL                                               'parse_url'
         2        SEND_VAR                                                 !0
         3        DO_ICALL                                         $4      
         4        ASSIGN                                                   !1, $4
   7     5        ISSET_ISEMPTY_DIM_OBJ                       33554432  ~6      !1, 'host'
         6      > JMPZ                                                     ~6, ->10
         7    >   FETCH_DIM_R                                      $7      !1, 'host'
         8        QM_ASSIGN                                        ~8      $7
         9      > JMP                                                      ->11
        10    >   QM_ASSIGN                                        ~8      ''
        11    >   ASSIGN                                                   !2, ~8
   8    12        INIT_FCALL                                               'preg_match'
        13        SEND_VAL                                                 '%2F%28%3FP%3Cdomain%3E%5Ba-z0-9%5D%5Ba-z0-9%5C-%5D%7B1%2C63%7D%5C.%5Ba-z%5C.%5D%7B2%2C6%7D%29%24%2Fi'
        14        SEND_VAR                                                 !2
        15        SEND_REF                                                 !3
        16        DO_ICALL                                         $10     
        17      > JMPZ                                                     $10, ->20
   9    18    >   FETCH_DIM_R                                      $11     !3, 'domain'
        19      > RETURN                                                   $11
  11    20    > > RETURN                                                   <false>
  12    21*     > RETURN                                                   null

End of function get_domain

Generated using Vulcan Logic Dumper, using php 7.2.0