3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '182507 { 6661(T) }, 182514 { 5551(T), 5553(T), 5552(T) }'; preg_match_all('/(\d+)\s*{\s*([^}]+)\s*}/', $string, $matches); $output = array(); foreach ($matches[1] as $key => $value) { $output[$key] = array_merge(array($value), preg_split('/\s*,\s*/', $matches[2][$key])); } print_r($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 25
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 25
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/Mdd2T
function name:  (null)
number of ops:  30
compiled vars:  !0 = $string, !1 = $matches, !2 = $output, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '182507+%7B+6661%28T%29+%7D%2C+182514+%7B+5551%28T%29%2C+5553%28T%29%2C+5552%28T%29+%7D'
    4     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%5Cd%2B%29%5Cs%2A%7B%5Cs%2A%28%5B%5E%7D%5D%2B%29%5Cs%2A%7D%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        ASSIGN                                                   !2, <array>
    6     7        FETCH_DIM_R                                      ~8      !1, 1
          8      > FE_RESET_R                                       $9      ~8, ->25
          9    > > FE_FETCH_R                                       ~10     $9, !3, ->25
         10    >   ASSIGN                                                   !4, ~10
    7    11        INIT_FCALL                                               'array_merge'
         12        INIT_ARRAY                                       ~13     !3
         13        SEND_VAL                                                 ~13
         14        INIT_FCALL                                               'preg_split'
         15        SEND_VAL                                                 '%2F%5Cs%2A%2C%5Cs%2A%2F'
         16        FETCH_DIM_R                                      ~14     !1, 2
         17        FETCH_DIM_R                                      ~15     ~14, !4
         18        SEND_VAL                                                 ~15
         19        DO_ICALL                                         $16     
         20        SEND_VAR                                                 $16
         21        DO_ICALL                                         $17     
         22        ASSIGN_DIM                                               !2, !4
         23        OP_DATA                                                  $17
    6    24      > JMP                                                      ->9
         25    >   FE_FREE                                                  $9
    9    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.23 ms | 1009 KiB | 17 Q