3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_print($item, $key) { echo "$key holds $item\n"; } function recursion($array) { 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; } } $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/qVJbI
function name:  (null)
number of ops:  6
compiled vars:  !0 = $information, !1 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   ASSIGN                                                   !0, <array>
   37     1        ASSIGN                                                   !1, 'login%2Ccustomer_id'
   39     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/qVJbI
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 = 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 = 13, Position 2 = 29
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 29
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/qVJbI
function name:  recursion
number of ops:  31
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        COUNT                                            ~3      !0
          2        IS_EQUAL                                                 ~3, 0
          3      > JMPZ                                                     ~4, ->5
   11     4    > > RETURN                                                   null
   13     5    >   NEW                                              $5      'RecursiveIteratorIterator'
   14     6        NEW                                              $6      'RecursiveArrayIterator'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $6
   15    10        SEND_VAL_EX                                              16
         11        DO_FCALL                                      0          
         12      > FE_RESET_R                                       $9      $5, ->29
         13    > > FE_FETCH_R                                       ~10     $9, !1, ->29
   16    14    >   ASSIGN                                                   !2, ~10
   18    15        TYPE_CHECK                                  128          !1
         16      > JMPZ                                                     ~12, ->23
   20    17    >   CONCAT                                           ~13     'My+Array+Node+', !2
         18        ECHO                                                     ~13
   21    19        INIT_FCALL_BY_NAME                                       'recursion'
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0          
         22      > JMP                                                      ->28
   25    23    >   CONCAT                                           ~15     'My+node+', !2
         24        CONCAT                                           ~16     ~15, '+with+value+'
         25        CONCAT                                           ~17     ~16, !1
         26        CONCAT                                           ~18     ~17, '%0A'
         27        ECHO                                                     ~18
   13    28    > > JMP                                                      ->13
         29    >   FE_FREE                                                  $9
   27    30      > RETURN                                                   null

End of function recursion

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.22 ms | 1403 KiB | 14 Q