PHP: What's the most efficient way to summarize a large array into just 10 arrays? -


my web app returns user images in specific folder (pictures taken each day in month) via array of filenames. issue number of images many (30-500 images).

what wanted provide summary of array, reducing array 10 images. first 10 limiting loop. represents first part (for few images of day) . wanted 10 images array in way 10 images equally spread out throughout day.

i think of several ways involving quite lot of code.

was wondering if knows of cool array function or method solves problem?

there no built-in function in php that. best thing think using of sizeof() function:

$size = sizeof($array); $chunksize = ceil($size/10); for($i = 0;$i<$size;$i+=$chunksize){     echo $array[$i]; } 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -