3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ABC { public static function parent($array, $keylist) { self::$array = $array; self::$keylist = $keylist; $keys = explode(",", self::$keylist); foreach($keys as $key) self::$array = self::recursion($key); } private static function recursion($key) { if(is_null(self::$array)) return; foreach(self::$array as $key_outer => $value_outer) { if($key === $key_outer) { unset(self::$array[$key_outer]); self::$array[$key_outer] = "**"; } else { if(is_array($value_outer)) { $v = self::recursion($value_outer, $key); if(!is_null($v)) { unset(self::$array[$key_outer]); self::$array[$key_outer] = $v; } } } } } private static $array; private static $keylist; } $information = array("login" => "someUsername", "password" => "somePassword", "card_pin"=>"card_1234", "pin"=>"pin_356", "iin" => "iin_123", "shipping" => array("value" => array("telephone" => array("inner_value" => "telephone_998"))), "cardnumber" => "card_number_876", "customer_id" => "customer_654", "telephone" => "someOtherTelephoneNumber555"); $list = "telephone,login"; print_r($information); ABC::parent($information, $list); echo "===========\n"; print_r(ABC::$array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DBdYv
function name:  (null)
number of ops:  15
compiled vars:  !0 = $information, !1 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   ASSIGN                                                   !0, <array>
   58     1        ASSIGN                                                   !1, 'telephone%2Clogin'
   60     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   61     5        INIT_STATIC_METHOD_CALL                                  'ABC', 'parent'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0          
   62     9        ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A'
   63    10        INIT_FCALL                                               'print_r'
         11        FETCH_STATIC_PROP_R          unknown             ~6      'array'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class ABC:
Function parent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/DBdYv
function name:  parent
number of ops:  22
compiled vars:  !0 = $array, !1 = $keylist, !2 = $keys, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ASSIGN_STATIC_PROP                                       'array'
          3        OP_DATA                                                  !0
    8     4        ASSIGN_STATIC_PROP                                       'keylist'
          5        OP_DATA                                                  !1
   10     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%2C'
          8        FETCH_STATIC_PROP_R          unknown             ~6      'keylist'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
   12    12      > FE_RESET_R                                       $9      !2, ->20
         13    > > FE_FETCH_R                                               $9, !3, ->20
   13    14    >   INIT_STATIC_METHOD_CALL                                  'recursion'
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0  $11     
         17        ASSIGN_STATIC_PROP                                       'array'
         18        OP_DATA                                                  $11
   12    19      > JMP                                                      ->13
         20    >   FE_FREE                                                  $9
   14    21      > RETURN                                                   null

End of function parent

Function recursion:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 33
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 33
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 32
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 32
Branch analysis from position: 32
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/DBdYv
function name:  recursion
number of ops:  35
compiled vars:  !0 = $key, !1 = $value_outer, !2 = $key_outer, !3 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        FETCH_STATIC_PROP_R          unknown             ~4      'array'
          2        TYPE_CHECK                                    2          ~4
          3      > JMPZ                                                     ~5, ->5
   19     4    > > RETURN                                                   null
   21     5    >   FETCH_STATIC_PROP_R          unknown             ~6      'array'
          6      > FE_RESET_R                                       $7      ~6, ->33
          7    > > FE_FETCH_R                                       ~8      $7, !1, ->33
          8    >   ASSIGN                                                   !2, ~8
   23     9        IS_IDENTICAL                                             !0, !2
         10      > JMPZ                                                     ~10, ->17
   25    11    >   FETCH_STATIC_PROP_UNSET                          $11     'array'
         12        UNSET_DIM                                                $11, !2
   26    13        FETCH_STATIC_PROP_W          unknown             $12     'array'
         14        ASSIGN_DIM                                               $12, !2
         15        OP_DATA                                                  '%2A%2A'
         16      > JMP                                                      ->32
   31    17    >   TYPE_CHECK                                  128          !1
         18      > JMPZ                                                     ~14, ->32
   33    19    >   INIT_STATIC_METHOD_CALL                                  'recursion'
         20        SEND_VAR                                                 !1
         21        SEND_VAR                                                 !0
         22        DO_FCALL                                      0  $15     
         23        ASSIGN                                                   !3, $15
   35    24        TYPE_CHECK                                    2  ~17     !3
         25        BOOL_NOT                                         ~18     ~17
         26      > JMPZ                                                     ~18, ->32
   37    27    >   FETCH_STATIC_PROP_UNSET                          $19     'array'
         28        UNSET_DIM                                                $19, !2
   38    29        FETCH_STATIC_PROP_W          unknown             $20     'array'
         30        ASSIGN_DIM                                               $20, !2
         31        OP_DATA                                                  !3
   21    32    > > JMP                                                      ->7
         33    >   FE_FREE                                                  $7
   43    34      > RETURN                                                   null

End of function recursion

End of class ABC.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.14 ms | 1396 KiB | 17 Q