3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'https://roger.shopery.dev/admin/'; $hostName = 'gros.cat'; $pattern = '~//([a-zA-Z0\.-9]+)([:0-9]+)?/(.*)~U'; var_dump( preg_replace( $pattern, "///$hostName$2/", $url ));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DfNf
function name:  (null)
number of ops:  15
compiled vars:  !0 = $url, !1 = $hostName, !2 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'https%3A%2F%2Froger.shopery.dev%2Fadmin%2F'
    4     1        ASSIGN                                                   !1, 'gros.cat'
    6     2        ASSIGN                                                   !2, '%7E%2F%2F%28%5Ba-zA-Z0%5C.-9%5D%2B%29%28%5B%3A0-9%5D%2B%29%3F%2F%28.%2A%29%7EU'
    8     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'preg_replace'
    9     5        SEND_VAR                                                 !2
   10     6        ROPE_INIT                                     3  ~7      '%2F%2F%2F'
          7        ROPE_ADD                                      1  ~7      ~7, !1
          8        ROPE_END                                      2  ~6      ~7, '%242%2F'
          9        SEND_VAL                                                 ~6
   11    10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $9      
         12        SEND_VAR                                                 $9
         13        DO_ICALL                                                 
   12    14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.72 ms | 1394 KiB | 17 Q