3v4l.org

run code in 300+ 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                                  '%00%7Bclosure%7D%2Fin%2FMDpeX%3A15%240'
   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        DO_ICALL                                         $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

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

Function %00%7Bclosure%7D%2Fin%2FMDpeX%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDpeX
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%2C+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FMDpeX%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.25 ms | 1394 KiB | 26 Q