3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [0=>[id=>105, bla=>"sd"], 1=>[id=>300, bla=>"mvk"]]; $fixed = []; foreach ($arr as $a) { $fixed[$a["id"]] = $a; } unset($arr); var_dump($fixed);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/15iEJ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $fixed, !2 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_CONSTANT                                   ~3      'id'
          1        INIT_ARRAY                                       ~4      105, ~3
          2        FETCH_CONSTANT                                   ~5      'bla'
          3        ADD_ARRAY_ELEMENT                                ~4      'sd', ~5
          4        INIT_ARRAY                                       ~6      ~4, 0
          5        FETCH_CONSTANT                                   ~7      'id'
          6        INIT_ARRAY                                       ~8      300, ~7
          7        FETCH_CONSTANT                                   ~9      'bla'
          8        ADD_ARRAY_ELEMENT                                ~8      'mvk', ~9
          9        ADD_ARRAY_ELEMENT                                ~6      ~8, 1
         10        ASSIGN                                                   !0, ~6
    4    11        ASSIGN                                                   !1, <array>
    5    12      > FE_RESET_R                                       $12     !0, ->18
         13    > > FE_FETCH_R                                               $12, !2, ->18
    6    14    >   FETCH_DIM_R                                      ~13     !2, 'id'
         15        ASSIGN_DIM                                               !1, ~13
         16        OP_DATA                                                  !2
    5    17      > JMP                                                      ->13
         18    >   FE_FREE                                                  $12
    8    19        UNSET_CV                                                 !0
    9    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.44 ms | 1395 KiB | 15 Q