3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urls = [ "/folder123/?id=foo", "index.php?id=foo" ]; foreach ($urls as $url) { preg_replace_callback('#^(?:/folder123/|index\.php)\K.*$#', function ($match) { var_dump($match[0]); }, $url); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/bD61J
function name:  (null)
number of ops:  12
compiled vars:  !0 = $urls, !1 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1      > FE_RESET_R                                       $3      !0, ->10
          2    > > FE_FETCH_R                                               $3, !1, ->10
    8     3    >   INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%23%5E%28%3F%3A%2Ffolder123%2F%7Cindex%5C.php%29%5CK.%2A%24%23'
          5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   10     6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !1
    8     8        DO_ICALL                                                 
    7     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
   11    11      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bD61J
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'var_dump'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   10     5      > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.18 ms | 1011 KiB | 15 Q