3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Recursion { private static function printArray() { print_r(self::$array); } public static function recursionInitiatorParent($information, $list) { self::$array = $information; self::$keylist = $list; $keywords = explode(",", self::$keylist); echo "Before: \n\n"; self::printArray(); foreach($keywords as $key) self::recursionInitiator(self::$array, $key); echo "\n======================================= \n\n"; self::printArray(); } private static function recursionInitiator($array, $key) { if(count($array) < 1) return; foreach($array as $record) { if(is_array($record)) recursionInitiator($record, $key); else { foreach($record as $key_internal=>$value_internal) if($key_internal === $key) $value_internal = self::$asterisk; } } } private static $asterisk = "**"; private static $array; private static $keylist; } $information = array("login" => "someUsername", "password" => "somePassword", "card_pin"=>"card_1234", "pin"=>"pin_356", "iin" => "iin_123", "shipping" => array("telephone" => "telephone_998"), "cardnumber" => "card_number_876", "customer_id" => "customer_654"); $list = "telephone,iin"; Recursion::recursionInitiatorParent($information, $list);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uCRJb
function name:  (null)
number of ops:  7
compiled vars:  !0 = $information, !1 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   ASSIGN                                                   !0, <array>
   58     1        ASSIGN                                                   !1, 'telephone%2Ciin'
   59     2        INIT_STATIC_METHOD_CALL                                  'Recursion', 'recursionInitiatorParent'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class Recursion:
Function printarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uCRJb
function name:  printArray
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'print_r'
          1        FETCH_STATIC_PROP_R          global lock         ~0      'array'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    7     4      > RETURN                                                   null

End of function printarray

Function recursioninitiatorparent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/uCRJb
function name:  recursionInitiatorParent
number of ops:  29
compiled vars:  !0 = $information, !1 = $list, !2 = $keywords, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ASSIGN_STATIC_PROP                                       'array'
          3        OP_DATA                                                  !0
   12     4        ASSIGN_STATIC_PROP                                       'keylist'
          5        OP_DATA                                                  !1
   14     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
   16    12        ECHO                                                     'Before%3A+%0A%0A'
   17    13        INIT_STATIC_METHOD_CALL                                  'printArray'
         14        DO_FCALL                                      0          
   19    15      > FE_RESET_R                                       $10     !2, ->24
         16    > > FE_FETCH_R                                               $10, !3, ->24
   20    17    >   INIT_STATIC_METHOD_CALL                                  'recursionInitiator'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_STATIC_PROP_FUNC_ARG   unknown             $11     'array'
         20        SEND_FUNC_ARG                                            $11
         21        SEND_VAR_EX                                              !3
         22        DO_FCALL                                      0          
   19    23      > JMP                                                      ->16
         24    >   FE_FREE                                                  $10
   22    25        ECHO                                                     '%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D+%0A%0A'
   23    26        INIT_STATIC_METHOD_CALL                                  'printArray'
         27        DO_FCALL                                      0          
   24    28      > RETURN                                                   null

End of function recursioninitiatorparent

Function recursioninitiator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 25
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 23
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/uCRJb
function name:  recursionInitiator
number of ops:  27
compiled vars:  !0 = $array, !1 = $key, !2 = $record, !3 = $value_internal, !4 = $key_internal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        COUNT                                            ~5      !0
          3        IS_SMALLER                                               ~5, 1
          4      > JMPZ                                                     ~6, ->6
   29     5    > > RETURN                                                   null
   31     6    > > FE_RESET_R                                       $7      !0, ->25
          7    > > FE_FETCH_R                                               $7, !2, ->25
   33     8    >   TYPE_CHECK                                  128          !2
          9      > JMPZ                                                     ~8, ->15
   34    10    >   INIT_FCALL_BY_NAME                                       'recursionInitiator'
         11        SEND_VAR_EX                                              !2
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
         14      > JMP                                                      ->24
   38    15    > > FE_RESET_R                                       $10     !2, ->23
         16    > > FE_FETCH_R                                       ~11     $10, !3, ->23
         17    >   ASSIGN                                                   !4, ~11
   39    18        IS_IDENTICAL                                             !4, !1
         19      > JMPZ                                                     ~13, ->22
   40    20    >   FETCH_STATIC_PROP_R          global lock         ~14     'asterisk'
         21        ASSIGN                                                   !3, ~14
   38    22    > > JMP                                                      ->16
         23    >   FE_FREE                                                  $10
   31    24    > > JMP                                                      ->7
         25    >   FE_FREE                                                  $7
   43    26      > RETURN                                                   null

End of function recursioninitiator

End of class Recursion.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.76 ms | 1409 KiB | 17 Q