3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"Template[URL]":"asdasdda.com","Template[UPC]":"548454854631… Example","FieldHow to Answer":"20"}'; $output = json_decode($json); print_r($output); $array = $output; foreach ($array as $key=>$value) { preg_match("/\[(.+)\]/",$key,$match); $newKey = preg_replace("/\[.+\]/","",$key); $newArray[$newKey][$match[1]] = $value; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 28
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/6DaU4
function name:  (null)
number of ops:  30
compiled vars:  !0 = $json, !1 = $output, !2 = $array, !3 = $value, !4 = $key, !5 = $match, !6 = $newKey, !7 = $newArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22Template%5BURL%5D%22%3A%22asdasdda.com%22%2C%22Template%5BUPC%5D%22%3A%22548454854631%E2%80%A6+Example%22%2C%22FieldHow+to+Answer%22%3A%2220%22%7D'
    4     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $9      
          4        ASSIGN                                                   !1, $9
    5     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
    9     8        ASSIGN                                                   !2, !1
   10     9      > FE_RESET_R                                       $13     !2, ->28
         10    > > FE_FETCH_R                                       ~14     $13, !3, ->28
         11    >   ASSIGN                                                   !4, ~14
   11    12        INIT_FCALL                                               'preg_match'
         13        SEND_VAL                                                 '%2F%5C%5B%28.%2B%29%5C%5D%2F'
         14        SEND_VAR                                                 !4
         15        SEND_REF                                                 !5
         16        DO_ICALL                                                 
   12    17        INIT_FCALL                                               'preg_replace'
         18        SEND_VAL                                                 '%2F%5C%5B.%2B%5C%5D%2F'
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !6, $17
   13    23        FETCH_DIM_R                                      ~20     !5, 1
         24        FETCH_DIM_W                                      $19     !7, !6
         25        ASSIGN_DIM                                               $19, ~20
         26        OP_DATA                                                  !3
   10    27      > JMP                                                      ->10
         28    >   FE_FREE                                                  $13
   14    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
209.32 ms | 1396 KiB | 21 Q