3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/{@(?<func>\w+)(\((?<params>(?:[^()]++|(?2))*)\))}/u'; $str = 'строка с {@rand(1||{@rand(2|3|{@rand(4|5)})})} и {@rand(1|{@rand(2|3|{@rand(4|5)})})}.'; if (preg_match_all($re, $str, $matches, 0, PREG_SET_ORDER)) { print_r($matches["func"]); print_r($matches["params"]); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/XAZ3P
function name:  (null)
number of ops:  19
compiled vars:  !0 = $re, !1 = $str, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%7B%40%28%3F%3Cfunc%3E%5Cw%2B%29%28%5C%28%28%3F%3Cparams%3E%28%3F%3A%5B%5E%28%29%5D%2B%2B%7C%28%3F2%29%29%2A%29%5C%29%29%7D%2Fu'
    4     1        ASSIGN                                                   !1, '%D1%81%D1%82%D1%80%D0%BE%D0%BA%D0%B0+%D1%81+%7B%40rand%281%7C%7C%7B%40rand%282%7C3%7C%7B%40rand%284%7C5%29%7D%29%7D%29%7D+%D0%B8+%7B%40rand%281%7C%7B%40rand%282%7C3%7C%7B%40rand%284%7C5%29%7D%29%7D%29%7D.'
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $5      
          9      > JMPZ                                                     $5, ->18
    6    10    >   INIT_FCALL                                               'print_r'
         11        FETCH_DIM_R                                      ~6      !2, 'func'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
    7    14        INIT_FCALL                                               'print_r'
         15        FETCH_DIM_R                                      ~8      !2, 'params'
         16        SEND_VAL                                                 ~8
         17        DO_ICALL                                                 
    8    18    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.46 ms | 1399 KiB | 17 Q