3v4l.org

run code in 500+ 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); $result = []; array_walk( $array, function($row, $k) use (&$result) { $result[$row['id']][$k] = $row; } ); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9iFUj
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array, !1 = $result
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        ASSIGN                                                       !1, <array>
   15     5        INIT_FCALL                                                   'array_walk'
   16     6        SEND_REF                                                     !0
   17     7        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          8        BIND_LEXICAL                                                 ~5, !1
   19     9        SEND_VAL                                                     ~5
   15    10        DO_ICALL                                                     
   21    11        INIT_FCALL                                                   'var_export'
         12        SEND_VAR                                                     !1
         13        DO_ICALL                                                     
         14      > 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/9iFUj
function name:  {closure:/in/9iFUj:17}
number of ops:  8
compiled vars:  !0 = $row, !1 = $k, !2 = $result
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      !0, 'id'
          4        FETCH_DIM_W                                          $4      !2, ~3
          5        ASSIGN_DIM                                                   $4, !1
          6        OP_DATA                                                      !0
   19     7      > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.59 ms | 1837 KiB | 16 Q