3v4l.org

run code in 500+ PHP versions simultaneously
<?php function restructureArray3($array, $x) { while ($x) $return [] = array_splice($array, 0, ceil(sizeof($array) / $x--)); return $return; } $array = range(1, 7); $x = 3; var_dump(array_map(function($array) { return implode(', ', $array); }, restructureArray3($array, $x)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDpeX
function name:  (null)
number of ops:  19
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                                                     7
          3        DO_ICALL                                             $2      
          4        ASSIGN                                                       !0, $2
   12     5        ASSIGN                                                       !1, 3
   15     6        INIT_FCALL                                                   'var_dump'
          7        INIT_FCALL                                                   'array_map'
          8        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
   16     9        SEND_VAL                                                     ~5
         10        INIT_FCALL                                                   'restructurearray3'
         11        SEND_VAR                                                     !0
         12        SEND_VAR                                                     !1
         13        DO_FCALL                                          0  $6      
         14        SEND_VAR                                                     $6
   15    15        DO_ICALL                                             $7      
   16    16        SEND_VAR                                                     $7
   15    17        DO_ICALL                                                     
   16    18      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDpeX
function name:  {closure:/in/MDpeX:15}
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
   16     1        FRAMELESS_ICALL_2                implode             ~1      '%2C+', !0
          2      > RETURN                                                       ~1
          3*     > RETURN                                                       null

End of Dynamic Function 0

Function restructurearray3:
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 = 17, Position 2 = 3
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 3
Branch analysis from position: 17
Branch analysis from position: 3
filename:       /in/MDpeX
function name:  restructureArray3
number of ops:  19
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                                                          ->16
    5     3    >   INIT_FCALL                                                   'array_splice'
          4        SEND_REF                                                     !0
          5        SEND_VAL                                                     0
          6        INIT_FCALL                                                   'ceil'
          7        COUNT                                                ~4      !0
          8        POST_DEC                                             ~5      !1
          9        DIV                                                  ~6      ~4, ~5
         10        SEND_VAL                                                     ~6
         11        DO_ICALL                                             $7      
         12        SEND_VAR                                                     $7
         13        DO_ICALL                                             $8      
         14        ASSIGN_DIM                                                   !2
         15        OP_DATA                                                      $8
    4    16    > > JMPNZ                                                        !1, ->3
    6    17    > > RETURN                                                       !2
    7    18*     > RETURN                                                       null

End of function restructurearray3

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.9 ms | 3017 KiB | 19 Q