3v4l.org

run code in 300+ PHP versions simultaneously
<?php $page_uri = 'http://www.example.com/some_path/to/?param=1'; $path_parts = pathinfo($page_uri); if (!isset($path_parts['extension']) && strlen($page_uri) > 1) { $end = substr($page_uri, -1, 1); $page_uri_slash_fixed = (($end == '/') ? substr($page_uri, 0, -1) : $page_uri . '/'); } echo $page_uri . PHP_EOL; echo $page_uri_slash_fixed;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 30
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 11
filename:       /in/AkOqX
function name:  (null)
number of ops:  34
compiled vars:  !0 = $page_uri, !1 = $path_parts, !2 = $end, !3 = $page_uri_slash_fixed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.example.com%2Fsome_path%2Fto%2F%3Fparam%3D1'
    5     1        INIT_FCALL                                               'pathinfo'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    7     5        ISSET_ISEMPTY_DIM_OBJ                         0  ~7      !1, 'extension'
          6        BOOL_NOT                                         ~8      ~7
          7      > JMPZ_EX                                          ~8      ~8, ->11
          8    >   STRLEN                                           ~9      !0
          9        IS_SMALLER                                       ~10     1, ~9
         10        BOOL                                             ~8      ~10
         11    > > JMPZ                                                     ~8, ->30
    8    12    >   INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 -1
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !2, $11
    9    18        IS_EQUAL                                                 !2, '%2F'
         19      > JMPZ                                                     ~13, ->27
         20    >   INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 0
         23        SEND_VAL                                                 -1
         24        DO_ICALL                                         $14     
         25        QM_ASSIGN                                        ~15     $14
         26      > JMP                                                      ->29
         27    >   CONCAT                                           ~16     !0, '%2F'
         28        QM_ASSIGN                                        ~15     ~16
         29    >   ASSIGN                                                   !3, ~15
   13    30    >   CONCAT                                           ~18     !0, '%0A'
         31        ECHO                                                     ~18
   14    32        ECHO                                                     !3
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.39 ms | 1388 KiB | 17 Q