3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_print($item, $key) { echo "$key holds $item\n"; } function recursion($array, $key_parent) { if(count($array) == 0) return; foreach (new RecursiveIteratorIterator( new RecursiveArrayIterator($array), RecursiveIteratorIterator::CATCH_GET_CHILD) as $key => $value) { if(is_array($value)) { echo 'My Array Node ' . $key; recursion($value); } else { //echo 'My node ' . $key . ' with value ' . $value . PHP_EOL; if($key == $key_parent) $array[$key] = "**"; } } } $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 = "login,customer_id"; print_r($information); //array_walk_recursive($information, 'test_print'); recursion($information, "login"); print_r($information);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V7cui
function name:  (null)
number of ops:  13
compiled vars:  !0 = $information, !1 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   ASSIGN                                                   !0, <array>
   41     1        ASSIGN                                                   !1, 'login%2Ccustomer_id'
   42     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   44     5        INIT_FCALL                                               'recursion'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'login'
          8        DO_FCALL                                      0          
   45     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function test_print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V7cui
function name:  test_print
number of ops:  8
compiled vars:  !0 = $item, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ROPE_INIT                                     4  ~3      !1
          3        ROPE_ADD                                      1  ~3      ~3, '+holds+'
          4        ROPE_ADD                                      2  ~3      ~3, !0
          5        ROPE_END                                      3  ~2      ~3, '%0A'
          6        ECHO                                                     ~2
    6     7      > RETURN                                                   null

End of function test_print

Function recursion:
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 = 14, Position 2 = 29
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 29
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 28
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/V7cui
function name:  recursion
number of ops:  31
compiled vars:  !0 = $array, !1 = $key_parent, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        COUNT                                            ~4      !0
          3        IS_EQUAL                                                 ~4, 0
          4      > JMPZ                                                     ~5, ->6
   11     5    > > RETURN                                                   null
   13     6    >   NEW                                              $6      'RecursiveIteratorIterator'
   14     7        NEW                                              $7      'RecursiveArrayIterator'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $7
   15    11        SEND_VAL_EX                                              16
         12        DO_FCALL                                      0          
         13      > FE_RESET_R                                       $10     $6, ->29
         14    > > FE_FETCH_R                                       ~11     $10, !2, ->29
   16    15    >   ASSIGN                                                   !3, ~11
   18    16        TYPE_CHECK                                  128          !2
         17      > JMPZ                                                     ~13, ->24
   20    18    >   CONCAT                                           ~14     'My+Array+Node+', !3
         19        ECHO                                                     ~14
   21    20        INIT_FCALL_BY_NAME                                       'recursion'
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0          
         23      > JMP                                                      ->28
   27    24    >   IS_EQUAL                                                 !3, !1
         25      > JMPZ                                                     ~16, ->28
   28    26    >   ASSIGN_DIM                                               !0, !3
         27        OP_DATA                                                  '%2A%2A'
   13    28    > > JMP                                                      ->14
         29    >   FE_FREE                                                  $10
   31    30      > RETURN                                                   null

End of function recursion

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.71 ms | 1403 KiB | 16 Q