3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Recursion { private static function printArray($a) { print_r($a); } public static function recursionInitiatorParent($information, $list) { self::$array = $information; self::$keylist = $list; $keywords = explode(",", self::$keylist); echo "Before: \n\n"; self::printArray(self::$array); //foreach($keywords as $key) self::recursionInitiator(self::$array, $key); echo "\n======================================= \n\n"; self::printArray(self::$array); } private static function recursionInitiator($a, $key) { foreach($a as $record) { if(is_array($record)) { self::recursionInitiator($record, $key); // echo "\n"; // self::printArray($record); } else { foreach($record as $k=>$v) if($k == $key) $record[$k] = self::$asterisk; // echo "\n" . $record; } } } 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/FjVjK
function name:  (null)
number of ops:  7
compiled vars:  !0 = $information, !1 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   ASSIGN                                                   !0, <array>
   61     1        ASSIGN                                                   !1, 'telephone%2Ciin'
   62     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/FjVjK
function name:  printArray
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    7     4      > RETURN                                                   null

End of function printarray

Function recursioninitiatorparent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FjVjK
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        FETCH_STATIC_PROP_R          unknown             ~9      'array'
         15        SEND_VAL                                                 ~9
         16        DO_FCALL                                      0          
   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          
   22    23        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    24        INIT_STATIC_METHOD_CALL                                  'printArray'
         25        FETCH_STATIC_PROP_R          unknown             ~13     'array'
         26        SEND_VAL                                                 ~13
         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 = 77) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/FjVjK
function name:  recursionInitiator
number of ops:  24
compiled vars:  !0 = $a, !1 = $key, !2 = $record, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2      > FE_RESET_R                                       $5      !0, ->22
          3    > > FE_FETCH_R                                               $5, !2, ->22
   30     4    >   TYPE_CHECK                                  128          !2
          5      > JMPZ                                                     ~6, ->11
   32     6    >   INIT_STATIC_METHOD_CALL                                  'recursionInitiator'
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0          
         10      > JMP                                                      ->21
   39    11    > > FE_RESET_R                                       $8      !2, ->20
         12    > > FE_FETCH_R                                       ~9      $8, !3, ->20
         13    >   ASSIGN                                                   !4, ~9
   40    14        IS_EQUAL                                                 !4, !1
         15      > JMPZ                                                     ~11, ->19
   41    16    >   FETCH_STATIC_PROP_R          unknown             ~13     'asterisk'
         17        ASSIGN_DIM                                               !2, !4
         18        OP_DATA                                                  ~13
   39    19    > > JMP                                                      ->12
         20    >   FE_FREE                                                  $8
   28    21    > > JMP                                                      ->3
         22    >   FE_FREE                                                  $5
   46    23      > RETURN                                                   null

End of function recursioninitiator

End of class Recursion.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.27 ms | 1408 KiB | 17 Q