3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = []; $array = ["[3]:9","[2]:6"]; foreach($array as $v){ preg_match("/\[(.*)\]:(.*)/",$v,$matches); $result[$matches[1]] = $matches[2]; } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Ir2v9
function name:  (null)
number of ops:  19
compiled vars:  !0 = $result, !1 = $array, !2 = $v, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $6      !1, ->14
          3    > > FE_FETCH_R                                               $6, !2, ->14
    6     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%2F%5C%5B%28.%2A%29%5C%5D%3A%28.%2A%29%2F'
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !3
          8        DO_ICALL                                                 
    7     9        FETCH_DIM_R                                      ~8      !3, 1
         10        FETCH_DIM_R                                      ~10     !3, 2
         11        ASSIGN_DIM                                               !0, ~8
         12        OP_DATA                                                  ~10
    5    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $6
    9    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.29 ms | 998 KiB | 15 Q