3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tokens = [ ':rr'=>5, ':tipo'=>'\[A-Z]' ]; $regex = '/#([a-zA-z0-9_]+)(:[a-zA-Z]+)/'; $pattern = '#nombre:tipo'; //echo preg_replace($regex, "(?<$1>".$tokens[(int) ${2}].")", $pattern); echo preg_replace_callback($regex, function (array $matches) { $tokens = [ ':rr'=>5, ':tipo'=>'\[A-Z]' ]; echo "(?<{$matches[1]}>{$tokens[$matches[2]]})"; }, $pattern);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UlE5X
function name:  (null)
number of ops:  11
compiled vars:  !0 = $tokens, !1 = $regex, !2 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, '%2F%23%28%5Ba-zA-z0-9_%5D%2B%29%28%3A%5Ba-zA-Z%5D%2B%29%2F'
   11     2        ASSIGN                                                   !2, '%23nombre%3Atipo'
   17     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAR                                                 !1
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FUlE5X%3A17%240'
   27     6        SEND_VAL                                                 ~6
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $7      
          9        ECHO                                                     $7
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FUlE5X%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UlE5X
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $matches, !1 = $tokens
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        ASSIGN                                                   !1, <array>
   26     2        ROPE_INIT                                     5  ~7      '%28%3F%3C'
          3        FETCH_DIM_R                                      ~3      !0, 1
          4        ROPE_ADD                                      1  ~7      ~7, ~3
          5        ROPE_ADD                                      2  ~7      ~7, '%3E'
          6        FETCH_DIM_R                                      ~4      !0, 2
          7        FETCH_DIM_R                                      ~5      !1, ~4
          8        ROPE_ADD                                      3  ~7      ~7, ~5
          9        ROPE_END                                      4  ~6      ~7, '%29'
         10        ECHO                                                     ~6
   27    11      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FUlE5X%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.59 ms | 1395 KiB | 15 Q