3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = "/var/log/apache/foo/bar"; // let's remove the last two folders from the path echo substr($path, 0, strrpos($path, '/', strrpos($path, '/') - strlen($path)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lH9uA
function name:  (null)
number of ops:  19
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fvar%2Flog%2Fapache%2Ffoo%2Fbar'
    6     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        INIT_FCALL                                               'strrpos'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '%2F'
          7        INIT_FCALL                                               'strrpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '%2F'
         10        DO_ICALL                                         $2      
         11        STRLEN                                           ~3      !0
         12        SUB                                              ~4      $2, ~3
         13        SEND_VAL                                                 ~4
         14        DO_ICALL                                         $5      
         15        SEND_VAR                                                 $5
         16        DO_ICALL                                         $6      
         17        ECHO                                                     $6
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.04 ms | 998 KiB | 15 Q