3v4l.org

run code in 500+ PHP versions simultaneously
<?php $items = [ ['ID' => 420, 'name' => 'Mary'], ['ID' => 10957, 'name' => 'Blah'] ]; $result = array_column($items, 'name', 'ID'); print_r($result); $result = array_column($items, null, 'ID'); print_r($result); $result = array_reduce($items, static function ($result, $item) { $result[$item['ID']] = $item; return $result; }); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fLMgL
function name:  (null)
number of ops:  29
compiled vars:  !0 = $items, !1 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    7     1        INIT_FCALL                                                   'array_column'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     'name'
          4        SEND_VAL                                                     'ID'
          5        DO_ICALL                                             $3      
          6        ASSIGN                                                       !1, $3
    8     7        INIT_FCALL                                                   'print_r'
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                                     
   10    10        INIT_FCALL                                                   'array_column'
         11        SEND_VAR                                                     !0
         12        SEND_VAL                                                     null
         13        SEND_VAL                                                     'ID'
         14        DO_ICALL                                             $6      
         15        ASSIGN                                                       !1, $6
   11    16        INIT_FCALL                                                   'print_r'
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                                     
   13    19        INIT_FCALL                                                   'array_reduce'
         20        SEND_VAR                                                     !0
         21        DECLARE_LAMBDA_FUNCTION                              ~9      [0]
   16    22        SEND_VAL                                                     ~9
   13    23        DO_ICALL                                             $10     
         24        ASSIGN                                                       !1, $10
   17    25        INIT_FCALL                                                   'print_r'
         26        SEND_VAR                                                     !1
         27        DO_ICALL                                                     
         28      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fLMgL
function name:  {closure:/in/fLMgL:13}
number of ops:  7
compiled vars:  !0 = $result, !1 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   14     2        FETCH_DIM_R                                          ~2      !1, 'ID'
          3        ASSIGN_DIM                                                   !0, ~2
          4        OP_DATA                                                      !1
   15     5      > RETURN                                                       !0
   16     6*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.9 ms | 2202 KiB | 16 Q