3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrData = array ( array( 'a' => 'test', 'c' => 1, 'd' => 2, 'e' => 'B' ), array( 'c' => 1, 'd' => 2, 'e' => 'B' ), array( 'b' => 'test2', 'c' => 1, 'd' => 2, 'e' => 'B' ) ); $keys = ['a','b','c','d','e']; $res=[]; foreach($keys as $val){ $res[$val] = array_column($arrData, $val)[0]; } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/5nQSS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $arrData, !1 = $keys, !2 = $res, !3 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, <array>
   25     2        ASSIGN                                                   !2, <array>
   26     3      > FE_RESET_R                                       $7      !1, ->13
          4    > > FE_FETCH_R                                               $7, !3, ->13
   27     5    >   INIT_FCALL                                               'array_column'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $9      
          9        FETCH_DIM_R                                      ~10     $9, 0
         10        ASSIGN_DIM                                               !2, !3
         11        OP_DATA                                                  ~10
   26    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $7
   29    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.05 ms | 1006 KiB | 15 Q