3v4l.org

run code in 500+ PHP versions simultaneously
<?php function stringifyRequestParamsRecursive(&$array) { foreach ($array as $k => &$v) { if ($k == 'multipart' && is_array($v)) { foreach ($v as $subk => &$subv) { if ( is_array($subv) && !empty($subv['name']) && !empty($subv['contents']) && is_resource($subv['contents']) ) { if ( get_resource_type($subv['contents']) === 'stream' && $metadata = stream_get_meta_data($subv['contents']) && !empty($metadata['uri']) ) { echo "Substituting\n"; $subv = '@ ' . $metadata['uri']; } } } } } } $a = ['multipart' => [['name' => 'foo', 'contents' => fopen('/tmp/aaaaaa', 'w')]]]; stringifyRequestParamsRecursive($a); echo json_encode($a, JSON_PRETTY_PRINT);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J9hlH
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   INIT_ARRAY                                           ~1      'foo', 'name'
          1        INIT_FCALL                                                   'fopen'
          2        SEND_VAL                                                     '%2Ftmp%2Faaaaaa'
          3        SEND_VAL                                                     'w'
          4        DO_ICALL                                             $2      
          5        ADD_ARRAY_ELEMENT                                    ~1      $2, 'contents'
          6        INIT_ARRAY                                           ~3      ~1
          7        INIT_ARRAY                                           ~4      ~3, 'multipart'
          8        ASSIGN                                                       !0, ~4
   27     9        INIT_FCALL                                                   'stringifyrequestparamsrecursive'
         10        SEND_REF                                                     !0
         11        DO_FCALL                                          0          
   29    12        INIT_FCALL                                                   'json_encode'
         13        SEND_VAR                                                     !0
         14        SEND_VAL                                                     128
         15        DO_ICALL                                             $7      
         16        ECHO                                                         $7
         17      > RETURN                                                       1

Function stringifyrequestparamsrecursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 50
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 50
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 49
Branch analysis from position: 9
2 jumps found. (Code = 125) Position 1 = 10, Position 2 = 48
Branch analysis from position: 10
2 jumps found. (Code = 126) Position 1 = 11, Position 2 = 48
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 47
Branch analysis from position: 26
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
2 jumps found. (Code = 46) Position 1 = 37, Position 2 = 40
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 47
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 47
Branch analysis from position: 40
Branch analysis from position: 42
Branch analysis from position: 47
Branch analysis from position: 25
Branch analysis from position: 21
Branch analysis from position: 17
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 48
Branch analysis from position: 49
Branch analysis from position: 8
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
filename:       /in/J9hlH
function name:  stringifyRequestParamsRecursive
number of ops:  52
compiled vars:  !0 = $array, !1 = $v, !2 = $k, !3 = $subv, !4 = $subk, !5 = $metadata
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1      > FE_RESET_RW                                          $6      !0, ->50
          2    > > FE_FETCH_RW                                          ~7      $6, !1, ->50
          3    >   ASSIGN                                                       !2, ~7
    5     4        IS_EQUAL                                             ~9      !2, 'multipart'
          5      > JMPZ_EX                                              ~9      ~9, ->8
          6    >   TYPE_CHECK                                      128  ~10     !1
          7        BOOL                                                 ~9      ~10
          8    > > JMPZ                                                         ~9, ->49
    6     9    > > FE_RESET_RW                                          $11     !1, ->48
         10    > > FE_FETCH_RW                                          ~12     $11, !3, ->48
         11    >   ASSIGN                                                       !4, ~12
    8    12        TYPE_CHECK                                      128  ~14     !3
         13      > JMPZ_EX                                              ~14     ~14, ->17
         14    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~15     !3, 'name'
         15        BOOL_NOT                                             ~16     ~15
         16        BOOL                                                 ~14     ~16
         17    > > JMPZ_EX                                              ~14     ~14, ->21
         18    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~17     !3, 'contents'
         19        BOOL_NOT                                             ~18     ~17
         20        BOOL                                                 ~14     ~18
         21    > > JMPZ_EX                                              ~14     ~14, ->25
    9    22    >   FETCH_DIM_R                                          ~19     !3, 'contents'
         23        TYPE_CHECK                                      512  ~20     ~19
         24        BOOL                                                 ~14     ~20
         25    > > JMPZ                                                         ~14, ->47
   12    26    >   INIT_FCALL                                                   'get_resource_type'
         27        FETCH_DIM_R                                          ~21     !3, 'contents'
         28        SEND_VAL                                                     ~21
         29        DO_ICALL                                             $22     
         30        IS_IDENTICAL                                         ~23     $22, 'stream'
         31      > JMPZ_EX                                              ~23     ~23, ->42
   13    32    >   INIT_FCALL                                                   'stream_get_meta_data'
         33        FETCH_DIM_R                                          ~24     !3, 'contents'
         34        SEND_VAL                                                     ~24
         35        DO_ICALL                                             $25     
         36      > JMPZ_EX                                              ~26     $25, ->40
   14    37    >   ISSET_ISEMPTY_DIM_OBJ                             1  ~27     !5, 'uri'
         38        BOOL_NOT                                             ~28     ~27
         39        BOOL                                                 ~26     ~28
   13    40    >   ASSIGN                                               ~29     !5, ~26
         41        BOOL                                                 ~23     ~29
         42    > > JMPZ                                                         ~23, ->47
   16    43    >   ECHO                                                         'Substituting%0A'
   17    44        FETCH_DIM_R                                          ~30     !5, 'uri'
         45        CONCAT                                               ~31     '%40+', ~30
         46        ASSIGN                                                       !3, ~31
    6    47    > > JMP                                                          ->10
         48    >   FE_FREE                                                      $11
    4    49    > > JMP                                                          ->2
         50    >   FE_FREE                                                      $6
   23    51      > RETURN                                                       null

End of function stringifyrequestparamsrecursive

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
141.18 ms | 3381 KiB | 18 Q