3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( 0 => Array ( 'id' => 1, 'column2' => 'value2', 'column3' => 'value3', 'column4' => 'value4', 'column5' => 'value5' ), 1 => Array ( 'id' => 1, 'column2' => 'value2', 'column3' => 'value3', 'column4' => 'value4', 'column5' => 'value5' ), 2 => Array ( 'id' => 2, 'column2' => 'value2', 'column3' => 'value3', 'column4' => 'value4', 'column5' => 'value5' ), ); $keys = array_keys(array_column($array, 'id'), 1); $new_array = array_map(function($k) use ($array){return $array[$k];}, $keys); print_r($new_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IoDA9
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $keys, !2 = $new_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'array_keys'
          2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'id'
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
   11    10        INIT_FCALL                                               'array_map'
         11        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         12        BIND_LEXICAL                                             ~7, !0
         13        SEND_VAL                                                 ~7
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !2, $8
   12    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > 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/IoDA9
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $k, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.6 ms | 1440 KiB | 17 Q