3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "http://myvcilocal.com"; $subdomain="test"; if(trim($subdomain) == '') { return $url; } $new = preg_replace_callback("~^(http://)?(([^.]+)\.)?([^.]+)\.([a-zA-Z0-9]+)(?=/|$)~",function($matches) use ($subdomain) { $matches[3] = $subdomain; print_r($matches); return $matches[3] = $subdomain; },$url); echo $new."\n".$url;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ckmft
function name:  (null)
number of ops:  20
compiled vars:  !0 = $url, !1 = $subdomain, !2 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fmyvcilocal.com'
          1        ASSIGN                                                   !1, 'test'
    4     2        INIT_FCALL                                               'trim'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $5      
          5        IS_EQUAL                                                 $5, ''
          6      > JMPZ                                                     ~6, ->8
    6     7    > > RETURN                                                   !0
    9     8    >   INIT_FCALL                                               'preg_replace_callback'
          9        SEND_VAL                                                 '%7E%5E%28http%3A%2F%2F%29%3F%28%28%5B%5E.%5D%2B%29%5C.%29%3F%28%5B%5E.%5D%2B%29%5C.%28%5Ba-zA-Z0-9%5D%2B%29%28%3F%3D%2F%7C%24%29%7E'
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fckmft%3A9%240'
         11        BIND_LEXICAL                                             ~7, !1
   13    12        SEND_VAL                                                 ~7
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
    9    15        ASSIGN                                                   !2, $8
   15    16        CONCAT                                           ~10     !2, '%0A'
         17        CONCAT                                           ~11     ~10, !0
         18        ECHO                                                     ~11
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fckmft%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ckmft
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $matches, !1 = $subdomain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        ASSIGN_DIM                                               !0, 3
          3        OP_DATA                                                  !1
   11     4        INIT_FCALL                                               'print_r'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   12     7        ASSIGN_DIM                                       ~4      !0, 3
          8        OP_DATA                                                  !1
          9      > RETURN                                                   ~4
   13    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fckmft%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.86 ms | 1396 KiB | 19 Q