3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{ "11111111": { "id": "val_somevalue5555", "customer": { "32312": { "name": "jane doe" } } }, "2222222": { "id": "val_somevalue25", "customer": { "32312234": { "name": "jane doe" } } } }]'; $jsonarr = json_decode($json, true); $newarr = []; foreach($jsonarr[0] as $key => $value) { $newarr[] = ['key' => $key, 'id' => $value['id']]; } var_dump($newarr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/qCvRd
function name:  (null)
number of ops:  22
compiled vars:  !0 = $json, !1 = $jsonarr, !2 = $newarr, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%0A++++%2211111111%22%3A+%7B%0A++++++++%22id%22%3A+%22val_somevalue5555%22%2C%0A++++++++%22customer%22%3A+%7B%0A++++++++++++%2232312%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22jane+doe%22%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%2C%0A++++%222222222%22%3A+%7B%0A++++++++%22id%22%3A+%22val_somevalue25%22%2C%0A++++++++%22customer%22%3A+%7B%0A++++++++++++%2232312234%22%3A+%7B%0A++++++++++++++++%22name%22%3A+%22jane+doe%22%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%0A%7D%5D'
   22     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
   23     6        ASSIGN                                                   !2, <array>
   25     7        FETCH_DIM_R                                      ~9      !1, 0
          8      > FE_RESET_R                                       $10     ~9, ->17
          9    > > FE_FETCH_R                                       ~11     $10, !3, ->17
         10    >   ASSIGN                                                   !4, ~11
   26    11        INIT_ARRAY                                       ~14     !4, 'key'
         12        FETCH_DIM_R                                      ~15     !3, 'id'
         13        ADD_ARRAY_ELEMENT                                ~14     ~15, 'id'
         14        ASSIGN_DIM                                               !2
         15        OP_DATA                                                  ~14
   25    16      > JMP                                                      ->9
         17    >   FE_FREE                                                  $10
   29    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.97 ms | 1001 KiB | 15 Q