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); $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                                  '%00%7Bclosure%7D%2Fin%2F9iFUj%3A17%240'
          8        BIND_LEXICAL                                             ~5, !1
   19     9        SEND_VAL                                                 ~5
         10        DO_ICALL                                                 
   21    11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9iFUj%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9iFUj
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2F9iFUj%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.24 ms | 1395 KiB | 19 Q