3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => ['id' => 20, 'name' => 'chimpanzee'], 'b' => ['id' => 40, 'name' => 'meeting'], 'c' => ['id' => 20, 'name' => 'dynasty'], 'd' => ['id' => 50, 'name' => 'chocolate'], 'e' => ['id' => 10, 'name' => 'bananas'], 'f' => ['id' => 50, 'name' => 'fantasy'], 'g' => ['id' => 50, 'name' => 'football'] ]; asort($array); var_export( array_reduce( array_keys($array), function($result, $k) use ($array) { $result[$array[$k]['id']][$k] = $array[$k]; return $result; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7hEGN
function name:  (null)
number of ops:  17
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'asort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
   14     4        INIT_FCALL                                               'var_export'
   15     5        INIT_FCALL                                               'array_reduce'
   16     6        INIT_FCALL                                               'array_keys'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
   17    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7hEGN%3A17%240'
         11        BIND_LEXICAL                                             ~4, !0
   20    12        SEND_VAL                                                 ~4
         13        DO_ICALL                                         $5      
         14        SEND_VAR                                                 $5
         15        DO_ICALL                                                 
   22    16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F7hEGN%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7hEGN
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $result, !1 = $k, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   18     3        FETCH_DIM_R                                      ~3      !2, !1
          4        FETCH_DIM_R                                      ~4      ~3, 'id'
          5        FETCH_DIM_R                                      ~7      !2, !1
          6        FETCH_DIM_W                                      $5      !0, ~4
          7        ASSIGN_DIM                                               $5, !1
          8        OP_DATA                                                  ~7
   19     9      > RETURN                                                   !0
   20    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7hEGN%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.34 ms | 1396 KiB | 21 Q