3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = json_decode('[{"value": "2310", "label": "Root >> test" },{"value": "2314", "label": "Root >> TV >> test" }]', true); var_dump($x); $results = []; foreach($x as $y) { $results[$y['value']] = $y['label']; } var_dump($results);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/NS8d0
function name:  (null)
number of ops:  21
compiled vars:  !0 = $x, !1 = $results, !2 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%7B%22value%22%3A+%222310%22%2C+%22label%22%3A+%22Root+%3E%3E+test%22+%7D%2C%7B%22value%22%3A+%222314%22%2C+%22label%22%3A+%22Root+%3E%3E+TV+%3E%3E+test%22+%7D%5D'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    4     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
    6     8        ASSIGN                                                   !1, <array>
    8     9      > FE_RESET_R                                       $7      !0, ->16
         10    > > FE_FETCH_R                                               $7, !2, ->16
    9    11    >   FETCH_DIM_R                                      ~8      !2, 'value'
         12        FETCH_DIM_R                                      ~10     !2, 'label'
         13        ASSIGN_DIM                                               !1, ~8
         14        OP_DATA                                                  ~10
    8    15      > JMP                                                      ->10
         16    >   FE_FREE                                                  $7
   12    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.51 ms | 1395 KiB | 17 Q