3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'var/log/some/other/directory/file.log'; $array = explode('/', $string); for ($c = count($array); $c > 0; ) { $output[--$c] = implode('/', $array); array_pop($array); } for ($i = 0; $i < count($output); $i++) { echo "$output[$i]\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 9
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 23
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 23
Branch analysis from position: 31
Branch analysis from position: 23
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 9
Branch analysis from position: 21
Branch analysis from position: 9
filename:       /in/4SPX3
function name:  (null)
number of ops:  32
compiled vars:  !0 = $string, !1 = $array, !2 = $c, !3 = $output, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'var%2Flog%2Fsome%2Fother%2Fdirectory%2Ffile.log'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    4     6        COUNT                                            ~8      !1
          7        ASSIGN                                                   !2, ~8
          8      > JMP                                                      ->19
    5     9    >   PRE_DEC                                          ~10     !2
         10        INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 '%2F'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $12     
         14        ASSIGN_DIM                                               !3, ~10
         15        OP_DATA                                                  $12
    6    16        INIT_FCALL                                               'array_pop'
         17        SEND_REF                                                 !1
         18        DO_ICALL                                                 
    4    19    >   IS_SMALLER                                               0, !2
         20      > JMPNZ                                                    ~14, ->9
    8    21    >   ASSIGN                                                   !4, 0
         22      > JMP                                                      ->28
    9    23    >   FETCH_DIM_R                                      ~16     !3, !4
         24        NOP                                                      
         25        FAST_CONCAT                                      ~17     ~16, '%0A'
         26        ECHO                                                     ~17
    8    27        PRE_INC                                                  !4
         28    >   COUNT                                            ~19     !3
         29        IS_SMALLER                                               !4, ~19
         30      > JMPNZ                                                    ~20, ->23
   10    31    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.63 ms | 1396 KiB | 19 Q