3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 44259 => [50007, 50009, 46372], 33333 => [11111], 50007 => [50008], 22222 => [33333], 50009 => [50010], 66666 => ['no', 'other', 'links'], 46372 => [46418, 46419, 46421], 46421 => [146880] ]; do { $changes = false; foreach ($array as $k => &$row) { foreach ($row as $v) { if (isset($array[$v])) { array_push($array[$k], ...$array[$v]); unset($array[$v]); $changes = true; } } } } while($changes); var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 1
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 1
Branch analysis from position: 21
filename:       /in/oqLPI
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $changes, !2 = $row, !3 = $k, !4 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1    >   ASSIGN                                                   !1, <false>
   16     2      > FE_RESET_RW                                      $7      !0, ->21
          3    > > FE_FETCH_RW                                      ~8      $7, !2, ->21
          4    >   ASSIGN                                                   !3, ~8
   17     5      > FE_RESET_R                                       $10     !2, ->19
          6    > > FE_FETCH_R                                               $10, !4, ->19
   18     7    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !4
          8      > JMPZ                                                     ~11, ->18
   19     9    >   INIT_FCALL                                               'array_push'
         10        FETCH_DIM_W                                      $12     !0, !3
         11        SEND_REF                                                 $12
         12        FETCH_DIM_R                                      ~13     !0, !4
         13        SEND_UNPACK                                              ~13
         14        CHECK_UNDEF_ARGS                                         
         15        DO_ICALL                                                 
   20    16        UNSET_DIM                                                !0, !4
   21    17        ASSIGN                                                   !1, <true>
   17    18    > > JMP                                                      ->6
         19    >   FE_FREE                                                  $10
   16    20      > JMP                                                      ->3
         21    >   FE_FREE                                                  $7
   25    22      > JMPNZ                                                    !1, ->1
   26    23    >   INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
200.82 ms | 1015 KiB | 15 Q