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 ); var_dump( $before ); var_dump( $after ); }
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 = 65
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 65
Branch analysis from position: 27
Branch analysis from position: 32
Branch analysis from position: 32
filename:       /in/9CKVs
function name:  (null)
number of ops:  66
compiled vars:  !0 = $found, !1 = $route, !2 = $r, !3 = $part, !4 = $uscore, !5 = $times, !6 = $parts, !7 = $before, !8 = $after
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                                         $11     
          8        SEND_VAR                                                 $11
          9        DO_ICALL                                         $12     
         10      > FE_RESET_R                                       $13     $12, ->32
         11    > > FE_FETCH_R                                       ~14     $13, !2, ->32
         12    >   ASSIGN                                                   !3, ~14
    7    13        INIT_FCALL                                               'strpos'
         14        SEND_VAR                                                 !2
         15        SEND_VAL                                                 '_'
         16        DO_ICALL                                         $16     
         17        ASSIGN                                                   !4, $16
    8    18        INIT_FCALL                                               'substr_count'
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 '_'
         21        DO_ICALL                                         $18     
         22        ASSIGN                                                   !5, $18
    9    23        IS_NOT_EQUAL                                     ~20     !5, 1
         24      > JMPNZ_EX                                         ~20     ~20, ->27
         25    >   IS_NOT_EQUAL                                     ~21     !4, 0
         26        BOOL                                             ~20     ~21
         27    > > JMPZ                                                     ~20, ->29
   11    28    > > JMP                                                      ->11
   14    29    >   ASSIGN                                                   !0, !3
   15    30      > JMP                                                      ->32
    5    31*       JMP                                                      ->11
         32    >   FE_FREE                                                  $13
   18    33        TYPE_CHECK                                  1020          !0
         34      > JMPZ                                                     ~23, ->65
   20    35    >   INIT_FCALL                                               'explode'
         36        SEND_VAL                                                 '%2F'
         37        INIT_FCALL                                               'trim'
         38        SEND_VAR                                                 !1
         39        SEND_VAL                                                 '%2F'
         40        DO_ICALL                                         $24     
         41        SEND_VAR                                                 $24
         42        DO_ICALL                                         $25     
         43        ASSIGN                                                   !6, $25
   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                                         $27     
         50        ASSIGN                                                   !7, $27
   23    51        INIT_FCALL                                               'array_slice'
         52        SEND_VAR                                                 !6
         53        ADD                                              ~29     !0, 1
         54        SEND_VAL                                                 ~29
         55        SEND_VAL                                                 null
         56        SEND_VAL                                                 <true>
         57        DO_ICALL                                         $30     
         58        ASSIGN                                                   !8, $30
   25    59        INIT_FCALL                                               'var_dump'
         60        SEND_VAR                                                 !7
         61        DO_ICALL                                                 
   26    62        INIT_FCALL                                               'var_dump'
         63        SEND_VAR                                                 !8
         64        DO_ICALL                                                 
   27    65    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156 ms | 1400 KiB | 25 Q