3v4l.org

run code in 300+ PHP versions simultaneously
<?php function t($parent_key, $parent_array, &$data) { foreach ($parent_array as $k => $v) { if (is_array($v)) { t("${parent_key}_${k}", $v, $data); } else { $data[trim("${parent_key}_${k}", '_')] = $v; } } } $data = array(); $attributes = array( 'Users' => array( 'Name' => 'Name', ), 'Address' => 'Address', 'Tags' => array( 0 => array( 'Key' => 'Key', 'Value' => 'Value', ), 1 => array( 'Key' => 'Key', ), 2 => array( ) ), ); t('', $attributes, $data); print_r($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UsD0a
function name:  (null)
number of ops:  11
compiled vars:  !0 = $data, !1 = $attributes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   31     2        INIT_FCALL                                               't'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !0
          6        DO_FCALL                                      0          
   32     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function t:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/UsD0a
function name:  t
number of ops:  29
compiled vars:  !0 = $parent_key, !1 = $parent_array, !2 = $data, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3      > FE_RESET_R                                       $5      !1, ->27
          4    > > FE_FETCH_R                                       ~6      $5, !3, ->27
          5    >   ASSIGN                                                   !4, ~6
    5     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~8, ->17
    6     8    >   INIT_FCALL_BY_NAME                                       't'
          9        ROPE_INIT                                     3  ~10     !0
         10        ROPE_ADD                                      1  ~10     ~10, '_'
         11        ROPE_END                                      2  ~9      ~10, !4
         12        SEND_VAL_EX                                              ~9
         13        SEND_VAR_EX                                              !3
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
         16      > JMP                                                      ->26
    8    17    >   INIT_FCALL                                               'trim'
         18        ROPE_INIT                                     3  ~14     !0
         19        ROPE_ADD                                      1  ~14     ~14, '_'
         20        ROPE_END                                      2  ~13     ~14, !4
         21        SEND_VAL                                                 ~13
         22        SEND_VAL                                                 '_'
         23        DO_ICALL                                         $16     
         24        ASSIGN_DIM                                               !2, $16
         25        OP_DATA                                                  !3
    4    26    > > JMP                                                      ->4
         27    >   FE_FREE                                                  $5
   11    28      > RETURN                                                   null

End of function t

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
223.32 ms | 1403 KiB | 18 Q