3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("A" => "aa", "B" => ["A" => "aaa", "B" => "bb"], "C" => "cc", "D" => ["E" =>"ee"]); function array_filter_recursive(array &$array, callable $callback) { foreach ($array as $key => &$value) { if ($callback($key, $value)) unset($array[$key]); else if (is_array($value)) array_filter_recursive($value, $callback); } } function sanitizedArray(&$arr, $restrictedProperties) { foreach($restrictedProperties as $prop) { array_filter_recursive($arr, function($k, $v) use ($prop) {return $prop == $k;}); } } sanitizedArray($arr, ["D"]); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/05tc7
function name:  (null)
number of ops:  9
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'sanitizedarray'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0          
   18     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function array_filter_recursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
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/05tc7
function name:  array_filter_recursive
number of ops:  21
compiled vars:  !0 = $array, !1 = $callback, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2      > FE_RESET_RW                                      $4      !0, ->19
          3    > > FE_FETCH_RW                                      ~5      $4, !2, ->19
          4    >   ASSIGN                                                   !3, ~5
    7     5        INIT_DYNAMIC_CALL                                        !1
          6        SEND_VAR_EX                                              !3
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0  $7      
          9      > JMPZ                                                     $7, ->12
         10    >   UNSET_DIM                                                !0, !3
         11      > JMP                                                      ->18
    8    12    >   TYPE_CHECK                                  128          !2
         13      > JMPZ                                                     ~8, ->18
         14    >   INIT_FCALL_BY_NAME                                       'array_filter_recursive'
         15        SEND_VAR_EX                                              !2
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
    6    18    > > JMP                                                      ->3
         19    >   FE_FREE                                                  $4
   10    20      > RETURN                                                   null

End of function array_filter_recursive

Function sanitizedarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/05tc7
function name:  sanitizedArray
number of ops:  13
compiled vars:  !0 = $arr, !1 = $restrictedProperties, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2      > FE_RESET_R                                       $3      !1, ->11
          3    > > FE_FETCH_R                                               $3, !2, ->11
   14     4    >   INIT_FCALL                                               'array_filter_recursive'
          5        SEND_REF                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F05tc7%3A14%240'
          7        BIND_LEXICAL                                             ~4, !2
          8        SEND_VAL                                                 ~4
          9        DO_FCALL                                      0          
   13    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $3
   16    12      > RETURN                                                   null

End of function sanitizedarray

Function %00%7Bclosure%7D%2Fin%2F05tc7%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/05tc7
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $k, !1 = $v, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        IS_EQUAL                                         ~3      !2, !0
          4      > RETURN                                                   ~3
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F05tc7%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.84 ms | 1407 KiB | 17 Q