3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['cust' => 'XT8900', 'type' => 'standard', 'level' => 1], ['cust' => 'XT8944', 'type' => 'standard', 'level' => 1], ['cust' => 'XT8922', 'type' => 'premier', 'level' => 3], ['cust' => 'XT8816', 'type' => 'permier', 'level' => 3], ['cust' => 'XT7434', 'type' => 'standard', 'level' => 7], ]; var_export( array_reduce( array_keys($array), function($result, $key) use ($array) { $result[array_pop($array[$key])][$key] = $array[$key]; return $result; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Wksl
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'var_export'
   12     2        INIT_FCALL                                               'array_reduce'
   13     3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
   14     7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F1Wksl%3A14%240'
          8        BIND_LEXICAL                                             ~3, !0
   17     9        SEND_VAL                                                 ~3
         10        DO_ICALL                                         $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                                 
   19    13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F1Wksl%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Wksl
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $result, !1 = $key, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   15     3        INIT_FCALL                                               'array_pop'
          4        FETCH_DIM_W                                      $3      !2, !1
          5        SEND_REF                                                 $3
          6        DO_ICALL                                         $4      
          7        FETCH_DIM_R                                      ~7      !2, !1
          8        FETCH_DIM_W                                      $5      !0, $4
          9        ASSIGN_DIM                                               $5, !1
         10        OP_DATA                                                  ~7
   16    11      > RETURN                                                   !0
   17    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F1Wksl%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.24 ms | 1396 KiB | 21 Q