3v4l.org

run code in 300+ PHP versions simultaneously
<?php function breakPartitionsLongerThan ($partitions, $length) { $ret = array(); foreach ($partitions as $partition) { $chunks = array_chunk ($partition, $length); if (count($chunks) > 1) for ($i = 0; $i < count ($chunks) - 1; $i++) // for every chunk except the last one, append the first address of the next chunk. $chunks[$i][] = $chunks[$i+1][0]; $ret = array_merge ($ret, $chunks); } return $ret; } var_dump (breakPartitionsLongerThan([[1,2,3,4,5],[6,7,8,9,10]], 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HCroi
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'breakpartitionslongerthan'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 1
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function breakpartitionslongerthan:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 32
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 32
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 15
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 15
Branch analysis from position: 26
Branch analysis from position: 15
Branch analysis from position: 26
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/HCroi
function name:  breakPartitionsLongerThan
number of ops:  35
compiled vars:  !0 = $partitions, !1 = $length, !2 = $ret, !3 = $partition, !4 = $chunks, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3      > FE_RESET_R                                       $7      !0, ->32
          4    > > FE_FETCH_R                                               $7, !3, ->32
    6     5    >   INIT_FCALL                                               'array_chunk'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !4, $8
    7    10        COUNT                                            ~10     !4
         11        IS_SMALLER                                               1, ~10
         12      > JMPZ                                                     ~11, ->26
    8    13    >   ASSIGN                                                   !5, 0
         14      > JMP                                                      ->22
   10    15    >   ADD                                              ~15     !5, 1
         16        FETCH_DIM_R                                      ~16     !4, ~15
         17        FETCH_DIM_R                                      ~17     ~16, 0
         18        FETCH_DIM_W                                      $13     !4, !5
         19        ASSIGN_DIM                                               $13
         20        OP_DATA                                                  ~17
    8    21        PRE_INC                                                  !5
         22    >   COUNT                                            ~19     !4
         23        SUB                                              ~20     ~19, 1
         24        IS_SMALLER                                               !5, ~20
         25      > JMPNZ                                                    ~21, ->15
   11    26    >   INIT_FCALL                                               'array_merge'
         27        SEND_VAR                                                 !2
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $22     
         30        ASSIGN                                                   !2, $22
    5    31      > JMP                                                      ->4
         32    >   FE_FREE                                                  $7
   13    33      > RETURN                                                   !2
   14    34*     > RETURN                                                   null

End of function breakpartitionslongerthan

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.83 ms | 1402 KiB | 20 Q