3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_split(array $array, $size) { $result = []; $i = 0; foreach ($array as $value) { $result[floor($i++ / $size)][] = $value; } return $result; } var_dump(array_split([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i2JqM
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'array_split'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 3
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function array_split:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/i2JqM
function name:  array_split
number of ops:  18
compiled vars:  !0 = $array, !1 = $size, !2 = $result, !3 = $i, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3        ASSIGN                                                   !3, 0
    7     4      > FE_RESET_R                                       $7      !0, ->15
          5    > > FE_FETCH_R                                               $7, !4, ->15
    8     6    >   INIT_FCALL                                               'floor'
          7        POST_INC                                         ~8      !3
          8        DIV                                              ~9      ~8, !1
          9        SEND_VAL                                                 ~9
         10        DO_ICALL                                         $10     
         11        FETCH_DIM_W                                      $11     !2, $10
         12        ASSIGN_DIM                                               $11
         13        OP_DATA                                                  !4
    7    14      > JMP                                                      ->5
         15    >   FE_FREE                                                  $7
   11    16      > RETURN                                                   !2
   12    17*     > RETURN                                                   null

End of function array_split

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.9 ms | 1398 KiB | 18 Q