3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(1, 10); $chunks = []; $chunkSize = 3; while ($array) { $chunkSize = 5 - $chunkSize; $chunks[] = array_splice($array, 0, $chunkSize); } var_export($chunks);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
Branch analysis from position: 8
filename:       /in/YQ5Sp
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $chunks, !2 = $chunkSize
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    5     5        ASSIGN                                                   !1, <array>
    6     6        ASSIGN                                                   !2, 3
    8     7      > JMP                                                      ->17
    9     8    >   SUB                                              ~7      5, !2
          9        ASSIGN                                                   !2, ~7
   10    10        INIT_FCALL                                               'array_splice'
         11        SEND_REF                                                 !0
         12        SEND_VAL                                                 0
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $10     
         15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  $10
    8    17    > > JMPNZ                                                    !0, ->8
   12    18    >   INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.73 ms | 999 KiB | 16 Q