3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'visitPoints'=>[ 20=>[2,5,6,8,10,11], 35=>[2,5,6], 57=>[1] ], 'islands'=>[ 20=>[5,10,11], 35=>[5,6] ], 'animals'=>[ 20=>[5,11], 35=>[] ] ]; /*$result = [ 20=>[5,11], 35=>[] ];*/ $result = array_shift($array); foreach ($array as $rows) { foreach ($rows as $k => $row) { $result[$k] = array_values(array_intersect($result[$k], $row)); } } echo '<pre>'; print_r($result); echo '</pre>';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/VS2LE
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array, !1 = $result, !2 = $rows, !3 = $row, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   23     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   24     5      > FE_RESET_R                                       $8      !0, ->23
          6    > > FE_FETCH_R                                               $8, !2, ->23
   25     7    > > FE_RESET_R                                       $9      !2, ->21
          8    > > FE_FETCH_R                                       ~10     $9, !3, ->21
          9    >   ASSIGN                                                   !4, ~10
   26    10        INIT_FCALL                                               'array_values'
         11        INIT_FCALL                                               'array_intersect'
         12        FETCH_DIM_R                                      ~13     !1, !4
         13        SEND_VAL                                                 ~13
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $14     
         16        SEND_VAR                                                 $14
         17        DO_ICALL                                         $15     
         18        ASSIGN_DIM                                               !1, !4
         19        OP_DATA                                                  $15
   25    20      > JMP                                                      ->8
         21    >   FE_FREE                                                  $9
   24    22      > JMP                                                      ->6
         23    >   FE_FREE                                                  $8
   29    24        ECHO                                                     '%3Cpre%3E'
   30    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
   31    28        ECHO                                                     '%3C%2Fpre%3E'
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.29 ms | 1009 KiB | 17 Q