3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 2 => 'first=1', 3 => 'second=2', 4 => 'third=', 5 => 'first=4', 9 => 'second=3', ]; $result = []; foreach ($array as $string) { [$key, $value] = explode('=', $string, 2); if (!isset($entry) || isset($entry[$key])) { unset($entry); $result[] = &$entry; } $entry[$key] = $value; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 26
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
Branch analysis from position: 19
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/M7nOE
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array, !1 = $result, !2 = $string, !3 = $key, !4 = $value, !5 = $entry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   12     2      > FE_RESET_R                                       $8      !0, ->26
          3    > > FE_FETCH_R                                               $8, !2, ->26
   13     4    >   INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%3D'
          6        SEND_VAR                                                 !2
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $9      
          9        FETCH_LIST_R                                     $10     $9, 0
         10        ASSIGN                                                   !3, $10
         11        FETCH_LIST_R                                     $12     $9, 1
         12        ASSIGN                                                   !4, $12
         13        FREE                                                     $9
   15    14        ISSET_ISEMPTY_CV                                 ~14     !5
         15        BOOL_NOT                                         ~15     ~14
         16      > JMPNZ_EX                                         ~15     ~15, ->19
         17    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~16     !5, !3
         18        BOOL                                             ~15     ~16
         19    > > JMPZ                                                     ~15, ->23
   16    20    >   UNSET_CV                                                 !5
   17    21        FETCH_DIM_W                                      $17     !1
         22        ASSIGN_REF                                               $17, !5
   19    23    >   ASSIGN_DIM                                               !5, !3
         24        OP_DATA                                                  !4
   12    25      > JMP                                                      ->3
         26    >   FE_FREE                                                  $8
   21    27        INIT_FCALL                                               'var_export'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.64 ms | 1396 KiB | 17 Q