3v4l.org

run code in 300+ PHP versions simultaneously
<?php $uris = [ '/auth/logout/msg/session/redirect_uri/sf/quote-details/show/632', '/auth/logout/msg/something/someothersomething/session/redirect_uri/sf/quote-details/show/632' ]; foreach($uris as $uri) { $pieces = explode('/', $uri); if ($pos = array_search("redirect_uri", $pieces, true) !== FALSE) { $cdr = array_slice($pieces, array_flip($pieces)['redirect_uri']+1); echo $uri, ' -> ', join('/', $cdr), "\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 35
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 35
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 34
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 34
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/P0hIZ
function name:  (null)
number of ops:  37
compiled vars:  !0 = $uris, !1 = $uri, !2 = $pieces, !3 = $pos, !4 = $cdr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1      > FE_RESET_R                                       $6      !0, ->35
          2    > > FE_FETCH_R                                               $6, !1, ->35
    8     3    >   INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
    9     8        INIT_FCALL                                               'array_search'
          9        SEND_VAL                                                 'redirect_uri'
         10        SEND_VAR                                                 !2
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $9      
         13        TYPE_CHECK                                  1018  ~10     $9
         14        ASSIGN                                           ~11     !3, ~10
         15      > JMPZ                                                     ~11, ->34
   10    16    >   INIT_FCALL                                               'array_slice'
         17        SEND_VAR                                                 !2
         18        INIT_FCALL                                               'array_flip'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $12     
         21        FETCH_DIM_R                                      ~13     $12, 'redirect_uri'
         22        ADD                                              ~14     ~13, 1
         23        SEND_VAL                                                 ~14
         24        DO_ICALL                                         $15     
         25        ASSIGN                                                   !4, $15
   11    26        ECHO                                                     !1
         27        ECHO                                                     '+-%3E+'
         28        INIT_FCALL                                               'join'
         29        SEND_VAL                                                 '%2F'
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $17     
         32        ECHO                                                     $17
         33        ECHO                                                     '%0A'
    7    34    > > JMP                                                      ->2
         35    >   FE_FREE                                                  $6
   13    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.98 ms | 941 KiB | 24 Q