3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = 'Home/Gallery/Images/Mountains'; $lastFolder = basename($path); $secondToLastFolder = basename(dirname($path)); echo "Last folder: {$lastFolder}\nSecond last folder: {$secondToLastFolder}";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cgOmM
function name:  (null)
number of ops:  18
compiled vars:  !0 = $path, !1 = $lastFolder, !2 = $secondToLastFolder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Home%2FGallery%2FImages%2FMountains'
    4     1        INIT_FCALL                                               'basename'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    5     5        INIT_FCALL                                               'basename'
          6        INIT_FCALL                                               'dirname'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !2, $7
    7    12        ROPE_INIT                                     4  ~10     'Last+folder%3A+'
         13        ROPE_ADD                                      1  ~10     ~10, !1
         14        ROPE_ADD                                      2  ~10     ~10, '%0ASecond+last+folder%3A+'
         15        ROPE_END                                      3  ~9      ~10, !2
         16        ECHO                                                     ~9
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.3 ms | 998 KiB | 15 Q