My understanding of the array_chunk method, returns a multidimensional array, chunked by an array size. In the following code, I want to return a certain set of URLs (a page worth), but it returns all of them. Do I need to remove the other values from my array?
function getImages($currentPage) {
$images = array();
try {
if (is_dir(self::FOLDER)) {
if ($dh = opendir(self::FOLDER)) {
while (($filename = readdir($dh)) !== false) {
if (($filename != ".") && ($filename != "..")) {
$image = self::FOLDER . "/" . $filename;
array_push($images, $image);
}
}
closedir($dh);
}
}
}
catch (Exception $ex)
{
}
sort($images, SORT_STRING);
array_chunk($images, 5, true);
return $images;
}