3v4l.org

run code in 300+ PHP versions simultaneously
<?php function breakPartitionsLongerThan ($partitions, $length) { $ret = array(); $partition = call_user_func_array ('array_merge', $partitions); $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)); var_dump (breakPartitionsLongerThan([[1,2,3,4,5],[6,7,8,9]], 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NYPgk
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     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                                                 
   18     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'breakpartitionslongerthan'
          9        SEND_VAL                                                 <array>
         10        SEND_VAL                                                 1
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function breakpartitionslongerthan:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
Branch analysis from position: 18
Branch analysis from position: 29
filename:       /in/NYPgk
function name:  breakPartitionsLongerThan
number of ops:  36
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        INIT_FCALL                                               'array_merge'
          4        SEND_ARRAY                                               !0
          5        CHECK_UNDEF_ARGS                                         
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !3, $7
    7     8        INIT_FCALL                                               'array_chunk'
          9        SEND_VAR                                                 !3
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !4, $9
    8    13        COUNT                                            ~11     !4
         14        IS_SMALLER                                               1, ~11
         15      > JMPZ                                                     ~12, ->29
    9    16    >   ASSIGN                                                   !5, 0
         17      > JMP                                                      ->25
   11    18    >   ADD                                              ~16     !5, 1
         19        FETCH_DIM_R                                      ~17     !4, ~16
         20        FETCH_DIM_R                                      ~18     ~17, 0
         21        FETCH_DIM_W                                      $14     !4, !5
         22        ASSIGN_DIM                                               $14
         23        OP_DATA                                                  ~18
    9    24        PRE_INC                                                  !5
         25    >   COUNT                                            ~20     !4
         26        SUB                                              ~21     ~20, 1
         27        IS_SMALLER                                               !5, ~21
         28      > JMPNZ                                                    ~22, ->18
   12    29    >   INIT_FCALL                                               'array_merge'
         30        SEND_VAR                                                 !2
         31        SEND_VAR                                                 !4
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !2, $23
   14    34      > RETURN                                                   !2
   15    35*     > RETURN                                                   null

End of function breakpartitionslongerthan

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.2 ms | 1394 KiB | 21 Q