3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convert($url) { return preg_replace('#:\/\/([^.]*\.)?'.preg_quote('mydomain.tld').'#', '://example.dev', $url); } var_dump(convert('http://haha.com/ferfe')); var_dump(convert('https://haha.com/ferfe')); var_dump(convert('http://foo.haha.com/ferfe')); var_dump(convert('https://foo.haha.com/ferfe'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L3XnV
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'convert'
          2        SEND_VAL                                                 'http%3A%2F%2Fhaha.com%2Fferfe'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    8     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'convert'
          8        SEND_VAL                                                 'https%3A%2F%2Fhaha.com%2Fferfe'
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
    9    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'convert'
         14        SEND_VAL                                                 'http%3A%2F%2Ffoo.haha.com%2Fferfe'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   10    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'convert'
         20        SEND_VAL                                                 'https%3A%2F%2Ffoo.haha.com%2Fferfe'
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function convert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L3XnV
function name:  convert
number of ops:  13
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        INIT_FCALL                                               'preg_quote'
          3        SEND_VAL                                                 'mydomain.tld'
          4        DO_ICALL                                         $1      
          5        CONCAT                                           ~2      '%23%3A%5C%2F%5C%2F%28%5B%5E.%5D%2A%5C.%29%3F', $1
          6        CONCAT                                           ~3      ~2, '%23'
          7        SEND_VAL                                                 ~3
          8        SEND_VAL                                                 '%3A%2F%2Fexample.dev'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11      > RETURN                                                   $4
    5    12*     > RETURN                                                   null

End of function convert

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.26 ms | 1399 KiB | 23 Q