3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 'set1' => [ 'key1' => 'value1', 'key2' => 'value2' ], 'set2' => [ 'key1' => 'value111', 'key2' => 'value222' ] ]; $output = [ 'out2' => [ 'key1' => 'value11', 'key2' => 'value22', 'key3' => 'value33', 'key4' => 'value44', 'key5' => 'value55', 'key6' => 'value66', ], 'out3' => [ 'key1' => 'value111', 'key2' => 'value222', 'key3' => 'value333', 'key4' => 'value444', 'key5' => 'value555', 'key6' => 'value666', ] ]; foreach($output as $key => $value) { foreach($input as $inputs) { if (array_intersect($value, $inputs) == $inputs) { $result[$key] = $value; } else { $missingSets[key($input)] = $inputs; } } } var_dump($result); var_dump($missingSets);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 22
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 22
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/Do6vO
function name:  (null)
number of ops:  32
compiled vars:  !0 = $input, !1 = $output, !2 = $value, !3 = $key, !4 = $inputs, !5 = $result, !6 = $missingSets
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   35     2      > FE_RESET_R                                       $9      !1, ->24
          3    > > FE_FETCH_R                                       ~10     $9, !2, ->24
          4    >   ASSIGN                                                   !3, ~10
   36     5      > FE_RESET_R                                       $12     !0, ->22
          6    > > FE_FETCH_R                                               $12, !4, ->22
   37     7    >   INIT_FCALL                                               'array_intersect'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !4
         10        DO_ICALL                                         $13     
         11        IS_EQUAL                                                 !4, $13
         12      > JMPZ                                                     ~14, ->16
   38    13    >   ASSIGN_DIM                                               !5, !3
         14        OP_DATA                                                  !2
         15      > JMP                                                      ->21
   40    16    >   INIT_FCALL                                               'key'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $16     
         19        ASSIGN_DIM                                               !6, $16
         20        OP_DATA                                                  !4
   36    21    > > JMP                                                      ->6
         22    >   FE_FREE                                                  $12
   35    23      > JMP                                                      ->3
         24    >   FE_FREE                                                  $9
   45    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                                 
   46    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !6
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.98 ms | 1396 KiB | 19 Q