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 = 11, Position 2 = 26
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 25
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/Qucpu
function name:  (null)
number of ops:  31
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>
    8     2        INIT_FCALL                                               'array_intersect_key'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'array_flip'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !2, $8
    9    10      > FE_RESET_R                                       $10     !0, ->26
         11    > > FE_FETCH_R                                       ~11     $10, !3, ->26
         12    >   ASSIGN                                                   !4, ~11
   11    13        TYPE_CHECK                                  128          !3
         14      > JMPZ                                                     ~13, ->25
   14    15    >   INIT_FCALL                                               'array_intersect_key'
         16        FETCH_DIM_R                                      ~15     !0, !4
         17        SEND_VAL                                                 ~15
         18        INIT_FCALL                                               'array_flip'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $16     
         21        SEND_VAR                                                 $16
         22        DO_ICALL                                         $17     
         23        ASSIGN_DIM                                               !2
         24        OP_DATA                                                  $17
    9    25    > > JMP                                                      ->11
         26    >   FE_FREE                                                  $10
   21    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.66 ms | 1401 KiB | 19 Q