Skip to content

BaseMax/PartitionArrayPHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Array Partition PHP

Partition an array into multiple arrays using PHP.

Example

Input

$input=[1,2,3,4,5,6,7];
$size=[3,2,2];

Output

Array (
    [0] => Array (
            [0] => 1
            [1] => 2
            [2] => 3
        )
    [1] => Array (
            [0] => 4
            [1] => 5
        )
    [2] => Array (
            [0] => 6
            [1] => 7
        )
)