3v4l.org

run code in 500+ PHP versions simultaneously
<?php function solve($input) { foreach($input as $index => $element) { if($index > 1 && $element < $input[$index - 1]) { return array_merge([array_slice($input, 0, $index)], solve(array_slice($input, $index))); } } return [$input]; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lKV2D
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E > > RETURN                                                       1

Function solve:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 31
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 31
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 30
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/lKV2D
function name:  solve
number of ops:  35
compiled vars:  !0 = $input, !1 = $element, !2 = $index
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1      > FE_RESET_R                                           $3      !0, ->31
          2    > > FE_FETCH_R                                           ~4      $3, !1, ->31
          3    >   ASSIGN                                                       !2, ~4
    5     4        IS_SMALLER                                           ~6      1, !2
          5      > JMPZ_EX                                              ~6      ~6, ->10
          6    >   SUB                                                  ~7      !2, 1
          7        FETCH_DIM_R                                          ~8      !0, ~7
          8        IS_SMALLER                                           ~9      !1, ~8
          9        BOOL                                                 ~6      ~9
         10    > > JMPZ                                                         ~6, ->30
    6    11    >   INIT_FCALL                                                   'array_merge'
         12        INIT_FCALL                                                   'array_slice'
         13        SEND_VAR                                                     !0
         14        SEND_VAL                                                     0
         15        SEND_VAR                                                     !2
         16        DO_ICALL                                             $10     
         17        INIT_ARRAY                                           ~11     $10
         18        SEND_VAL                                                     ~11
         19        INIT_FCALL_BY_NAME                                           'solve'
         20        INIT_FCALL                                                   'array_slice'
         21        SEND_VAR                                                     !0
         22        SEND_VAR                                                     !2
         23        DO_ICALL                                             $12     
         24        SEND_VAR_NO_REF_EX                                           $12
         25        DO_FCALL                                          0  $13     
         26        SEND_VAR                                                     $13
         27        DO_ICALL                                             $14     
         28        FE_FREE                                                      $3
         29      > RETURN                                                       $14
    4    30    > > JMP                                                          ->2
         31    >   FE_FREE                                                      $3
    9    32        INIT_ARRAY                                           ~15     !0
         33      > RETURN                                                       ~15
   10    34*     > RETURN                                                       null

End of function solve

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.09 ms | 3076 KiB | 15 Q