3v4l.org

run code in 500+ PHP versions simultaneously
<?php $re = '/^(#\h*)((\[\d+]|\{\d+}|\(\d+\))(?:\h+(?3))*)$/m'; $str = '# [1] {1} [2] {10} [3] [3] [4] {10} {100} [1] [5] # [5] {1} [6] (10) (20) (10) {10} [7] [5] [6] {10} {100} [8] [5] (10) (30) # (10) (30) [7] {1} [8] {10} [9] [7] [8] {100} {101} [9] [5] {101} (50)'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); echo implode("\n", array_map(fn($x) => $x[1] . implode(' ', array_unique(explode(' ', $x[2]))), $matches));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K0Wif
function name:  (null)
number of ops:  17
compiled vars:  !0 = $re, !1 = $str, !2 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2F%5E%28%23%5Ch%2A%29%28%28%5C%5B%5Cd%2B%5D%7C%5C%7B%5Cd%2B%7D%7C%5C%28%5Cd%2B%5C%29%29%28%3F%3A%5Ch%2B%28%3F3%29%29%2A%29%24%2Fm'
    4     1        ASSIGN                                                       !1, '%23+%5B1%5D+%7B1%7D+%5B2%5D+%7B10%7D+%5B3%5D+%5B3%5D+%5B4%5D+%7B10%7D+%7B100%7D+%5B1%5D+%5B5%5D%0A%23+%5B5%5D+%7B1%7D+%5B6%5D+%2810%29+%2820%29+%2810%29+%7B10%7D+%5B7%5D+%5B5%5D+%5B6%5D+%7B10%7D+%7B100%7D+%5B8%5D+%5B5%5D+%2810%29+%2830%29%0A%23+%2810%29+%2830%29+%5B7%5D+%7B1%7D+%5B8%5D+%7B10%7D+%5B9%5D+%5B7%5D+%5B8%5D+%7B100%7D+%7B101%7D+%5B9%5D+%5B5%5D+%7B101%7D+%2850%29'
    8     2        INIT_FCALL                                                   'preg_match_all'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        SEND_REF                                                     !2
          6        SEND_VAL                                                     2
          7        SEND_VAL                                                     0
          8        DO_ICALL                                                     
    9     9        INIT_FCALL                                                   'array_map'
         10        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
         11        SEND_VAL                                                     ~6
         12        SEND_VAR                                                     !2
         13        DO_ICALL                                             $7      
         14        FRAMELESS_ICALL_2                implode             ~8      '%0A', $7
         15        ECHO                                                         ~8
         16      > 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/K0Wif
function name:  {closure:/in/K0Wif:9}
number of ops:  14
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
          0  E >   RECV                                                 !0      
          1        FETCH_DIM_R                                          ~1      !0, 1
          2        INIT_FCALL                                                   'array_unique'
          3        INIT_FCALL                                                   'explode'
          4        SEND_VAL                                                     '+'
          5        FETCH_DIM_R                                          ~2      !0, 2
          6        SEND_VAL                                                     ~2
          7        DO_ICALL                                             $3      
          8        SEND_VAR                                                     $3
          9        DO_ICALL                                             $4      
         10        FRAMELESS_ICALL_2                implode             ~5      '+', $4
         11        CONCAT                                               ~6      ~1, ~5
         12      > RETURN                                                       ~6
         13*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.28 ms | 1884 KiB | 17 Q