3v4l.org

run code in 300+ PHP versions simultaneously
<?php $resultset = [ ['id' => 1, 'type' => 'F-A', 'name' => 'jon', 'age' => 24], ['id' => 2, 'type' => 'F-A', 'name' => 'roy', 'age' => 25], ['id' => 3, 'type' => 'F-E', 'name' => 'robert', 'age' => 26], ['id' => 4, 'type' => 'F-E', 'name' => 'sina', 'age' => 25] ]; foreach ($resultset as $row) { $output['type'][$row['type']][] = ['name' => $row['name'], 'age' => $row['age'], 'id' => $row['id']]; } echo json_encode($output, JSON_PRETTY_PRINT);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/AERXJ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $resultset, !1 = $row, !2 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1      > FE_RESET_R                                       $4      !0, ->15
          2    > > FE_FETCH_R                                               $4, !1, ->15
   10     3    >   FETCH_DIM_R                                      ~6      !1, 'type'
          4        FETCH_DIM_R                                      ~9      !1, 'name'
          5        INIT_ARRAY                                       ~10     ~9, 'name'
          6        FETCH_DIM_R                                      ~11     !1, 'age'
          7        ADD_ARRAY_ELEMENT                                ~10     ~11, 'age'
          8        FETCH_DIM_R                                      ~12     !1, 'id'
          9        ADD_ARRAY_ELEMENT                                ~10     ~12, 'id'
         10        FETCH_DIM_W                                      $5      !2, 'type'
         11        FETCH_DIM_W                                      $7      $5, ~6
         12        ASSIGN_DIM                                               $7
         13        OP_DATA                                                  ~10
    9    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $4
   12    16        INIT_FCALL                                               'json_encode'
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 128
         19        DO_ICALL                                         $13     
         20        ECHO                                                     $13
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.4 ms | 1408 KiB | 15 Q