3v4l.org

run code in 300+ PHP versions simultaneously
<?php $params = array("full"); $route = "/user/[a-z0-9:username]+"; $path = "/user/l33t"; $reg = str_replace('/','\/',preg_replace_callback('~\[([a-z0-9\.\-_\+]+)\:([a-z0-9\_]+)\](\+|\*|\{[0-9]+(?:,[0-9]+)?\})?~', function($matches) use(&$params) { $params[] = $matches[2]; return '[' . $matches[1] . ']' . $matches[3]; }, $route)); var_dump(preg_match('~^' . $reg . '$~',$path, $matches)); var_dump($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pSl9A
function name:  (null)
number of ops:  30
compiled vars:  !0 = $params, !1 = $route, !2 = $path, !3 = $reg, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, '%2Fuser%2F%5Ba-z0-9%3Ausername%5D%2B'
    4     2        ASSIGN                                                   !2, '%2Fuser%2Fl33t'
    5     3        INIT_FCALL                                               'str_replace'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAL                                                 '%5C%2F'
          6        INIT_FCALL                                               'preg_replace_callback'
          7        SEND_VAL                                                 '%7E%5C%5B%28%5Ba-z0-9%5C.%5C-_%5C%2B%5D%2B%29%5C%3A%28%5Ba-z0-9%5C_%5D%2B%29%5C%5D%28%5C%2B%7C%5C%2A%7C%5C%7B%5B0-9%5D%2B%28%3F%3A%2C%5B0-9%5D%2B%29%3F%5C%7D%29%3F%7E'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpSl9A%3A5%240'
          9        BIND_LEXICAL                                             ~8, !0
    8    10        SEND_VAL                                                 ~8
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                         $10     
    5    15        ASSIGN                                                   !3, $10
    9    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'preg_match'
         18        CONCAT                                           ~12     '%7E%5E', !3
         19        CONCAT                                           ~13     ~12, '%24%7E'
         20        SEND_VAL                                                 ~13
         21        SEND_VAR                                                 !2
         22        SEND_REF                                                 !4
         23        DO_ICALL                                         $14     
         24        SEND_VAR                                                 $14
         25        DO_ICALL                                                 
   10    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FpSl9A%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.22 ms | 1392 KiB | 21 Q