3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a1 = array( 'a1' => array('a_name' => 'aaa', 'a_value' => 'aaaaa'), 'b1' => array('b_name' => 'bbb', 'b_value' => 'bbbbbb'), 'c1' => array('c_name' => 'ccc', 'c_value' => 'cccccc') ); function twoLevelFilter($master, $filter) { foreach ($filter as $key => $value) { if (isset($master[$key])) { if (is_iterable($value)) { $master[$key] = array_diff_key($master[$key], $value); } else { unset($master[$key]); } } } return $master; } var_export(twoLevelFilter($a1, ['b1' => ['b_name' => 'zzzzz']])); echo "\n---\n"; var_export(twoLevelFilter($a1, ['b1' => 'zzzzz']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7nD5l
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a1
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   22     1        INIT_FCALL                                                   'var_export'
          2        INIT_FCALL                                                   'twolevelfilter'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     <array>
          5        DO_FCALL                                          0  $2      
          6        SEND_VAR                                                     $2
          7        DO_ICALL                                                     
   23     8        ECHO                                                         '%0A---%0A'
   24     9        INIT_FCALL                                                   'var_export'
         10        INIT_FCALL                                                   'twolevelfilter'
         11        SEND_VAR                                                     !0
         12        SEND_VAL                                                     <array>
         13        DO_FCALL                                          0  $4      
         14        SEND_VAR                                                     $4
         15        DO_ICALL                                                     
         16      > RETURN                                                       1

Function twolevelfilter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/7nD5l
function name:  twoLevelFilter
number of ops:  24
compiled vars:  !0 = $master, !1 = $filter, !2 = $value, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2      > FE_RESET_R                                           $4      !1, ->21
          3    > > FE_FETCH_R                                           ~5      $4, !2, ->21
          4    >   ASSIGN                                                       !3, ~5
   11     5        ISSET_ISEMPTY_DIM_OBJ                             0          !0, !3
          6      > JMPZ                                                         ~7, ->20
   12     7    >   INIT_FCALL                                                   'is_iterable'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                             $8      
         10      > JMPZ                                                         $8, ->19
   13    11    >   INIT_FCALL                                                   'array_diff_key'
         12        FETCH_DIM_R                                          ~10     !0, !3
         13        SEND_VAL                                                     ~10
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                             $11     
         16        ASSIGN_DIM                                                   !0, !3
         17        OP_DATA                                                      $11
   12    18      > JMP                                                          ->20
   15    19    >   UNSET_DIM                                                    !0, !3
   10    20    > > JMP                                                          ->3
         21    >   FE_FREE                                                      $4
   19    22      > RETURN                                                       !0
   20    23*     > RETURN                                                       null

End of function twolevelfilter

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.03 ms | 1935 KiB | 18 Q