3v4l.org

run code in 300+ PHP versions simultaneously
<?php function collapse($path, $collapse, &$result) { foreach($collapse AS $key => $value) { if(is_array($value)) { collapse($path . $key . "/", $value, $result); continue; } $result[] = $value; } } $result = array(); $toCollapse = array( "bla.tif", "quux.tif", array("foo" => array("bar" => array("lorem" => array("ipsum.tif", "doler.tif")))), array("bar" => array("qux" => array("baz" => array("ipsum.tif", "ufo.tif")))) ); collapse("", $toCollapse, $result); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e0CT6
function name:  (null)
number of ops:  11
compiled vars:  !0 = $result, !1 = $toCollapse
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   25     2        INIT_FCALL                                               'collapse'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !0
          6        DO_FCALL                                      0          
   27     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function collapse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/e0CT6
function name:  collapse
number of ops:  21
compiled vars:  !0 = $path, !1 = $collapse, !2 = $result, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3      > FE_RESET_R                                       $5      !1, ->19
          4    > > FE_FETCH_R                                       ~6      $5, !3, ->19
          5    >   ASSIGN                                                   !4, ~6
    7     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~8, ->16
    9     8    >   INIT_FCALL_BY_NAME                                       'collapse'
          9        CONCAT                                           ~9      !0, !4
         10        CONCAT                                           ~10     ~9, '%2F'
         11        SEND_VAL_EX                                              ~10
         12        SEND_VAR_EX                                              !3
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
   10    15      > JMP                                                      ->4
   12    16    >   ASSIGN_DIM                                               !2
         17        OP_DATA                                                  !3
    5    18      > JMP                                                      ->4
         19    >   FE_FREE                                                  $5
   14    20      > RETURN                                                   null

End of function collapse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.85 ms | 1399 KiB | 16 Q