3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array('test' => array('percy' => array('hello' => 'hatcherson'), 'percy' => array('mitchell', 'anderson'))); $allowed = array('percy'); $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 = 13, Position 2 = 28
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/oCiG7
function name:  (null)
number of ops:  33
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>
    8     3        INIT_FCALL                                               'array_intersect_key'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'array_flip'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $9      
          8        SEND_VAR                                                 $9
          9        DO_ICALL                                         $10     
         10        ASSIGN_DIM                                               !2
         11        OP_DATA                                                  $10
    9    12      > FE_RESET_R                                       $11     !0, ->28
         13    > > FE_FETCH_R                                       ~12     $11, !3, ->28
         14    >   ASSIGN                                                   !4, ~12
   11    15        TYPE_CHECK                                  128          !3
         16      > JMPZ                                                     ~14, ->27
   14    17    >   INIT_FCALL                                               'array_intersect_key'
         18        FETCH_DIM_R                                      ~16     !0, !4
         19        SEND_VAL                                                 ~16
         20        INIT_FCALL                                               'array_flip'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $17     
         23        SEND_VAR                                                 $17
         24        DO_ICALL                                         $18     
         25        ASSIGN_DIM                                               !2
         26        OP_DATA                                                  $18
    9    27    > > JMP                                                      ->13
         28    >   FE_FREE                                                  $11
   21    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.42 ms | 1396 KiB | 19 Q