3v4l.org

run code in 300+ PHP versions simultaneously
<?php preg_match('/^[^.]*\.(?=\w+\.\w+$)/','subdomain.example.com',$matches); $subdomain = isset($matches[0]) ? trim($matches[0],'.') : ''; echo $subdomain;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dOdAH
function name:  (null)
number of ops:  18
compiled vars:  !0 = $matches, !1 = $subdomain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'preg_match'
          1        SEND_VAL                                                 '%2F%5E%5B%5E.%5D%2A%5C.%28%3F%3D%5Cw%2B%5C.%5Cw%2B%24%29%2F'
          2        SEND_VAL                                                 'subdomain.example.com'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                                 
    5     5        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 0
          6      > JMPZ                                                     ~3, ->14
          7    >   INIT_FCALL                                               'trim'
          8        FETCH_DIM_R                                      ~4      !0, 0
          9        SEND_VAL                                                 ~4
         10        SEND_VAL                                                 '.'
         11        DO_ICALL                                         $5      
         12        QM_ASSIGN                                        ~6      $5
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~6      ''
         15    >   ASSIGN                                                   !1, ~6
    7    16        ECHO                                                     !1
    8    17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.41 ms | 998 KiB | 15 Q