Voting

: min(three, three)?
(Example: nine)

The Note You're Voting On

Anonymous
4 years ago
Most easy way split array to parts

<?php

$arr
= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

print_r(array_chunk($arr, ceil(count($arr) / 2)));
// return: [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]

print_r(array_chunk($arr, ceil(count($arr) / 3)));
// return: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10]]

?>

<< Back to user notes page

To Top