3v4l.org

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

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

End of function recursion

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.54 ms | 1402 KiB | 14 Q