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 = []; foreach ($array as $k => $row) { $result[$row['id']][$k] = $row; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/YpU4K
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $k
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      > FE_RESET_R                                       $7      !0, ->13
          6    > > FE_FETCH_R                                       ~8      $7, !2, ->13
          7    >   ASSIGN                                                   !3, ~8
   16     8        FETCH_DIM_R                                      ~10     !2, 'id'
          9        FETCH_DIM_W                                      $11     !1, ~10
         10        ASSIGN_DIM                                               $11, !3
         11        OP_DATA                                                  !2
   15    12      > JMP                                                      ->6
         13    >   FE_FREE                                                  $7
   18    14        INIT_FCALL                                               'var_export'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.29 ms | 1395 KiB | 17 Q