3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set( 'error_reporing', -1 ); ini_set( 'display_errors', 1 ); $result = array_slice( array(), 10, 10, true ); var_dump( $result ); exit; $found = null; $route = '/_ticket/'; 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; } var_dump( $before ); var_dump( $after ); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/cucDK
function name:  (null)
number of ops:  101
compiled vars:  !0 = $result, !1 = $found, !2 = $route, !3 = $r, !4 = $part, !5 = $uscore, !6 = $times, !7 = $parts, !8 = $before, !9 = $after, !10 = $replacePart
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'error_reporing'
          2        SEND_VAL                                                 -1
          3        DO_ICALL                                                 
    3     4        INIT_FCALL                                               'ini_set'
          5        SEND_VAL                                                 'display_errors'
          6        SEND_VAL                                                 1
          7        DO_ICALL                                                 
    5     8        INIT_FCALL                                               'array_slice'
          9        SEND_VAL                                                 <array>
         10        SEND_VAL                                                 10
         11        SEND_VAL                                                 10
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $13     
         14        ASSIGN                                                   !0, $13
    6    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > EXIT                                                     
    8    19*       ASSIGN                                                   !1, null
    9    20*       ASSIGN                                                   !2, '%2F_ticket%2F'
   11    21*       INIT_FCALL                                               'explode'
         22*       SEND_VAL                                                 '%2F'
         23*       INIT_FCALL                                               'trim'
         24*       SEND_VAR                                                 !2
         25*       SEND_VAL                                                 '%2F'
         26*       DO_ICALL                                         $18     
         27*       SEND_VAR                                                 $18
         28*       DO_ICALL                                         $19     
         29*       FE_RESET_R                                       $20     $19, ->51
         30*       FE_FETCH_R                                       ~21     $20, !3, ->51
         31*       ASSIGN                                                   !4, ~21
   13    32*       INIT_FCALL                                               'strpos'
         33*       SEND_VAR                                                 !3
         34*       SEND_VAL                                                 '_'
         35*       DO_ICALL                                         $23     
         36*       ASSIGN                                                   !5, $23
   14    37*       INIT_FCALL                                               'substr_count'
         38*       SEND_VAR                                                 !3
         39*       SEND_VAL                                                 '_'
         40*       DO_ICALL                                         $25     
         41*       ASSIGN                                                   !6, $25
   15    42*       IS_NOT_EQUAL                                     ~27     !6, 1
         43*       JMPNZ_EX                                         ~27     ~27, ->46
         44*       IS_NOT_EQUAL                                     ~28     !5, 0
         45*       BOOL                                             ~27     ~28
         46*       JMPZ                                                     ~27, ->48
   17    47*       JMP                                                      ->30
   20    48*       ASSIGN                                                   !1, !4
   21    49*       JMP                                                      ->51
   11    50*       JMP                                                      ->30
         51*       FE_FREE                                                  $20
   24    52*       TYPE_CHECK                                  1020          !1
         53*       JMPZ                                                     ~30, ->100
   26    54*       INIT_FCALL                                               'explode'
         55*       SEND_VAL                                                 '%2F'
         56*       INIT_FCALL                                               'trim'
         57*       SEND_VAR                                                 !2
         58*       SEND_VAL                                                 '%2F'
         59*       DO_ICALL                                         $31     
         60*       SEND_VAR                                                 $31
         61*       DO_ICALL                                         $32     
         62*       ASSIGN                                                   !7, $32
   28    63*       INIT_FCALL                                               'array_slice'
         64*       SEND_VAR                                                 !7
         65*       SEND_VAL                                                 0
         66*       SEND_VAR                                                 !1
         67*       SEND_VAL                                                 <true>
         68*       DO_ICALL                                         $34     
         69*       ASSIGN                                                   !8, $34
   29    70*       INIT_FCALL                                               'array_slice'
         71*       SEND_VAR                                                 !7
         72*       ADD                                              ~36     !1, 1
         73*       SEND_VAL                                                 ~36
         74*       SEND_VAL                                                 null
         75*       SEND_VAL                                                 <true>
         76*       DO_ICALL                                         $37     
         77*       ASSIGN                                                   !9, $37
   30    78*       INIT_FCALL                                               'ltrim'
         79*       FETCH_DIM_R                                      ~39     !7, !1
         80*       SEND_VAL                                                 ~39
         81*       SEND_VAL                                                 '_'
         82*       DO_ICALL                                         $40     
         83*       ASSIGN                                                   !10, $40
   32    84*       ASSIGN_DIM                                               !8
         85*       OP_DATA                                                  !10
   33    86*       ASSIGN_DIM                                               !8
         87*       OP_DATA                                                  !10
   35    88*       FE_RESET_R                                       $44     !9, ->93
         89*       FE_FETCH_R                                               $44, !4, ->93
   37    90*       ASSIGN_DIM                                               !8
         91*       OP_DATA                                                  !4
   35    92*       JMP                                                      ->89
         93*       FE_FREE                                                  $44
   40    94*       INIT_FCALL                                               'var_dump'
         95*       SEND_VAR                                                 !8
         96*       DO_ICALL                                                 
   41    97*       INIT_FCALL                                               'var_dump'
         98*       SEND_VAR                                                 !9
         99*       DO_ICALL                                                 
   42   100*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
212.65 ms | 1404 KiB | 29 Q