3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array('test' => array('percy' => array('hello' => 'hatcherson'), 'percy' => array('mitchell', 'anderson'))); $allowed = array('test'); $combined = array(); //$combined[] = array_intersect_key($arr, array_flip($allowed)); foreach ($arr as $k => $v) { if (is_array($v)) { $combined[] = array_intersect_key($arr[$k], array_flip($allowed)); } } var_dump($combined);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/6afgX
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $allowed, !2 = $combined, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <array>
    7     2        ASSIGN                                                   !2, <array>
    9     3      > FE_RESET_R                                       $8      !0, ->19
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->19
          5    >   ASSIGN                                                   !4, ~9
   11     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~11, ->18
   14     8    >   INIT_FCALL                                               'array_intersect_key'
          9        FETCH_DIM_R                                      ~13     !0, !4
         10        SEND_VAL                                                 ~13
         11        INIT_FCALL                                               'array_flip'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $14     
         14        SEND_VAR                                                 $14
         15        DO_ICALL                                         $15     
         16        ASSIGN_DIM                                               !2
         17        OP_DATA                                                  $15
    9    18    > > JMP                                                      ->4
         19    >   FE_FREE                                                  $8
   21    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.59 ms | 1395 KiB | 19 Q