3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = '[1,[01,11,12] ,4 ,5, [20,21,22]]'; $parts = preg_split('/,(?![^\[]*\])/', $string, -1, PREG_SPLIT_DELIM_CAPTURE); $output = array(); foreach ($parts as $part) { $part = trim($part, '[] '); $output[] = explode(',', $part); } print_r($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/v4b9i
function name:  (null)
number of ops:  25
compiled vars:  !0 = $string, !1 = $parts, !2 = $output, !3 = $part
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%5B1%2C%5B01%2C11%2C12%5D+%2C4+%2C5%2C+%5B20%2C21%2C22%5D%5D'
    4     1        INIT_FCALL                                                   'preg_split'
          2        SEND_VAL                                                     '%2F%2C%28%3F%21%5B%5E%5C%5B%5D%2A%5C%5D%29%2F'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     -1
          5        SEND_VAL                                                     2
          6        DO_ICALL                                             $5      
          7        ASSIGN                                                       !1, $5
    5     8        ASSIGN                                                       !2, <array>
    6     9      > FE_RESET_R                                           $8      !1, ->20
         10    > > FE_FETCH_R                                                   $8, !3, ->20
    7    11    >   FRAMELESS_ICALL_2                trim                ~9      !3, '%5B%5D+'
         12        ASSIGN                                                       !3, ~9
    8    13        INIT_FCALL                                                   'explode'
         14        SEND_VAL                                                     '%2C'
         15        SEND_VAR                                                     !3
         16        DO_ICALL                                             $12     
         17        ASSIGN_DIM                                                   !2
         18        OP_DATA                                                      $12
    6    19      > JMP                                                          ->10
         20    >   FE_FREE                                                      $8
   10    21        INIT_FCALL                                                   'print_r'
         22        SEND_VAR                                                     !2
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.97 ms | 2177 KiB | 16 Q