3v4l.org

run code in 300+ PHP versions simultaneously
<?php function restructureArray3($array, $x) { while ($x) $return [] = implode(', ', array_splice($array, 0, ceil(sizeof($array) / $x--))); return $return; } $array = range(1, 100); $x = 3; var_dump(restructureArray3($array, $x));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qojoe
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 100
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
   12     5        ASSIGN                                                   !1, 3
   15     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'restructurearray3'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function restructurearray3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 3
Branch analysis from position: 21
Branch analysis from position: 3
filename:       /in/Qojoe
function name:  restructureArray3
number of ops:  23
compiled vars:  !0 = $array, !1 = $x, !2 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2      > JMP                                                      ->20
    5     3    >   INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%2C+'
          5        INIT_FCALL                                               'array_splice'
          6        SEND_REF                                                 !0
          7        SEND_VAL                                                 0
          8        INIT_FCALL                                               'ceil'
          9        COUNT                                            ~4      !0
         10        POST_DEC                                         ~5      !1
         11        DIV                                              ~6      ~4, ~5
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                         $9      
         18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  $9
    4    20    > > JMPNZ                                                    !1, ->3
    6    21    > > RETURN                                                   !2
    7    22*     > RETURN                                                   null

End of function restructurearray3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.17 ms | 1403 KiB | 24 Q