3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nums = array(2,3,1); $data = array(11,22,33,44,55,66); $startingIndex = 0; for ($i=0; $i < count($nums); $i++) { $a[] = array_slice($data,$startingIndex,$nums[$i]); $startingIndex+=$nums[$i]; } var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
Branch analysis from position: 5
filename:       /in/h09ut
function name:  (null)
number of ops:  23
compiled vars:  !0 = $nums, !1 = $data, !2 = $startingIndex, !3 = $i, !4 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
    7     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->16
    8     5    >   INIT_FCALL                                               'array_slice'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        FETCH_DIM_R                                      ~10     !0, !3
          9        SEND_VAL                                                 ~10
         10        DO_ICALL                                         $11     
         11        ASSIGN_DIM                                               !4
         12        OP_DATA                                                  $11
    9    13        FETCH_DIM_R                                      ~12     !0, !3
         14        ASSIGN_OP                                     1          !2, ~12
    7    15        PRE_INC                                                  !3
         16    >   COUNT                                            ~15     !0
         17        IS_SMALLER                                               !3, ~15
         18      > JMPNZ                                                    ~16, ->5
   12    19    >   INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.59 ms | 1395 KiB | 17 Q