3v4l.org

run code in 300+ PHP versions simultaneously
<?php $found = null; $route = '/_ticket/show/xxx'; foreach ( explode( '/', trim( $route, '/' ) ) as $part => $r ) { $uscore = strpos( $r, '_' ); $times = substr_count( $r, '_' ); if ( 1 != $times || 0 != $uscore ) { continue; } $found = $part; break; } if ( null !== $found ) { $parts = explode( '/', trim( $route, '/' ) ); $before = array_slice( $parts, 0, $found, true ); $after = array_slice( $parts, $found + 1, null, true ); $replacePart = ltrim( $parts[ $found ], '_' ); $before[] = $replacePart; $before[] = $replacePart; foreach ( $after as $part ) { $before[] = $part; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 32
Branch analysis from position: 12
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 75
Branch analysis from position: 35
2 jumps found. (Code = 77) Position 1 = 70, Position 2 = 74
Branch analysis from position: 70
2 jumps found. (Code = 78) Position 1 = 71, Position 2 = 74
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
Branch analysis from position: 74
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
Branch analysis from position: 75
Branch analysis from position: 27
Branch analysis from position: 32
Branch analysis from position: 32
filename:       /in/fT6oG
function name:  (null)
number of ops:  76
compiled vars:  !0 = $found, !1 = $route, !2 = $r, !3 = $part, !4 = $uscore, !5 = $times, !6 = $parts, !7 = $before, !8 = $after, !9 = $replacePart
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, null
    3     1        ASSIGN                                                   !1, '%2F_ticket%2Fshow%2Fxxx'
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2F'
          4        INIT_FCALL                                               'trim'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 '%2F'
          7        DO_ICALL                                         $12     
          8        SEND_VAR                                                 $12
          9        DO_ICALL                                         $13     
         10      > FE_RESET_R                                       $14     $13, ->32
         11    > > FE_FETCH_R                                       ~15     $14, !2, ->32
         12    >   ASSIGN                                                   !3, ~15
    7    13        INIT_FCALL                                               'strpos'
         14        SEND_VAR                                                 !2
         15        SEND_VAL                                                 '_'
         16        DO_ICALL                                         $17     
         17        ASSIGN                                                   !4, $17
    8    18        INIT_FCALL                                               'substr_count'
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 '_'
         21        DO_ICALL                                         $19     
         22        ASSIGN                                                   !5, $19
    9    23        IS_NOT_EQUAL                                     ~21     !5, 1
         24      > JMPNZ_EX                                         ~21     ~21, ->27
         25    >   IS_NOT_EQUAL                                     ~22     !4, 0
         26        BOOL                                             ~21     ~22
         27    > > JMPZ                                                     ~21, ->29
   11    28    > > JMP                                                      ->11
   14    29    >   ASSIGN                                                   !0, !3
   15    30      > JMP                                                      ->32
    5    31*       JMP                                                      ->11
         32    >   FE_FREE                                                  $14
   18    33        TYPE_CHECK                                  1020          !0
         34      > JMPZ                                                     ~24, ->75
   20    35    >   INIT_FCALL                                               'explode'
         36        SEND_VAL                                                 '%2F'
         37        INIT_FCALL                                               'trim'
         38        SEND_VAR                                                 !1
         39        SEND_VAL                                                 '%2F'
         40        DO_ICALL                                         $25     
         41        SEND_VAR                                                 $25
         42        DO_ICALL                                         $26     
         43        ASSIGN                                                   !6, $26
   22    44        INIT_FCALL                                               'array_slice'
         45        SEND_VAR                                                 !6
         46        SEND_VAL                                                 0
         47        SEND_VAR                                                 !0
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $28     
         50        ASSIGN                                                   !7, $28
   23    51        INIT_FCALL                                               'array_slice'
         52        SEND_VAR                                                 !6
         53        ADD                                              ~30     !0, 1
         54        SEND_VAL                                                 ~30
         55        SEND_VAL                                                 null
         56        SEND_VAL                                                 <true>
         57        DO_ICALL                                         $31     
         58        ASSIGN                                                   !8, $31
   24    59        INIT_FCALL                                               'ltrim'
         60        FETCH_DIM_R                                      ~33     !6, !0
         61        SEND_VAL                                                 ~33
         62        SEND_VAL                                                 '_'
         63        DO_ICALL                                         $34     
         64        ASSIGN                                                   !9, $34
   26    65        ASSIGN_DIM                                               !7
         66        OP_DATA                                                  !9
   27    67        ASSIGN_DIM                                               !7
         68        OP_DATA                                                  !9
   29    69      > FE_RESET_R                                       $38     !8, ->74
         70    > > FE_FETCH_R                                               $38, !3, ->74
   31    71    >   ASSIGN_DIM                                               !7
         72        OP_DATA                                                  !3
   29    73      > JMP                                                      ->70
         74    >   FE_FREE                                                  $38
   33    75    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1392 KiB | 25 Q