3v4l.org

run code in 300+ PHP versions simultaneously
<?php define(DS, '/'); $server_path = "/test1/test2/"; $server_path = str_replace(array('/', '\\'), DS, $server_path); $next_server_path = substr($server_path, 0, strrpos($server_path, DS)); var_dump($next_server_path); $server_path = "/test1/test2"; $server_path = str_replace(array('/', '\\'), DS, $server_path); $next_server_path = substr($server_path, 0, strrpos($server_path, DS)); var_dump($next_server_path);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qqb2Q
function name:  (null)
number of ops:  50
compiled vars:  !0 = $server_path, !1 = $next_server_path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'define'
          1        FETCH_CONSTANT                                   ~2      'DS'
          2        SEND_VAL                                                 ~2
          3        SEND_VAL                                                 '%2F'
          4        DO_ICALL                                                 
    3     5        ASSIGN                                                   !0, '%2Ftest1%2Ftest2%2F'
    4     6        INIT_FCALL                                               'str_replace'
          7        SEND_VAL                                                 <array>
          8        FETCH_CONSTANT                                   ~5      'DS'
          9        SEND_VAL                                                 ~5
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !0, $6
    5    13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 0
         16        INIT_FCALL                                               'strrpos'
         17        SEND_VAR                                                 !0
         18        FETCH_CONSTANT                                   ~8      'DS'
         19        SEND_VAL                                                 ~8
         20        DO_ICALL                                         $9      
         21        SEND_VAR                                                 $9
         22        DO_ICALL                                         $10     
         23        ASSIGN                                                   !1, $10
    6    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
    9    27        ASSIGN                                                   !0, '%2Ftest1%2Ftest2'
   10    28        INIT_FCALL                                               'str_replace'
         29        SEND_VAL                                                 <array>
         30        FETCH_CONSTANT                                   ~14     'DS'
         31        SEND_VAL                                                 ~14
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $15     
         34        ASSIGN                                                   !0, $15
   11    35        INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !0
         37        SEND_VAL                                                 0
         38        INIT_FCALL                                               'strrpos'
         39        SEND_VAR                                                 !0
         40        FETCH_CONSTANT                                   ~17     'DS'
         41        SEND_VAL                                                 ~17
         42        DO_ICALL                                         $18     
         43        SEND_VAR                                                 $18
         44        DO_ICALL                                         $19     
         45        ASSIGN                                                   !1, $19
   12    46        INIT_FCALL                                               'var_dump'
         47        SEND_VAR                                                 !1
         48        DO_ICALL                                                 
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.17 ms | 1400 KiB | 23 Q