3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = "\\/var\\/www\\/resources\\/"; $pathChunks = explode("/", $path); print_r($pathChunks); $len = count($pathChunks); $storageFolder = $pathChunks[$len-1]; if(strlen($storageFolder) == 0) { $storageFolder = $pathChunks[$len-2]; } print_r($storageFolder); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/Mns5I
function name:  (null)
number of ops:  24
compiled vars:  !0 = $path, !1 = $pathChunks, !2 = $len, !3 = $storageFolder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5C%2Fvar%5C%2Fwww%5C%2Fresources%5C%2F'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    4     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
    5     9        COUNT                                            ~8      !1
         10        ASSIGN                                                   !2, ~8
    6    11        SUB                                              ~10     !2, 1
         12        FETCH_DIM_R                                      ~11     !1, ~10
         13        ASSIGN                                                   !3, ~11
    7    14        STRLEN                                           ~13     !3
         15        IS_EQUAL                                                 ~13, 0
         16      > JMPZ                                                     ~14, ->20
    8    17    >   SUB                                              ~15     !2, 2
         18        FETCH_DIM_R                                      ~16     !1, ~15
         19        ASSIGN                                                   !3, ~16
   10    20    >   INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
   11    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.11 ms | 1395 KiB | 17 Q