3v4l.org

run code in 300+ PHP versions simultaneously
<?php $params = array("full"); $route = "/user/[a-z0-9:username]+"; echo 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($params);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VrLXW
function name:  (null)
number of ops:  14
compiled vars:  !0 = $params, !1 = $route
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        INIT_FCALL                                               'preg_replace_callback'
          3        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%2B%7C%2A%7C%7B%5B0-9%5D%28%3F%3A%2C%5B0-9%5D%29%3F%7D%3F%29%7E'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FVrLXW%3A4%240'
          5        BIND_LEXICAL                                             ~4, !0
    7     6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        ECHO                                                     $5
    8    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FVrLXW%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.15 ms | 1396 KiB | 17 Q