foreach(array_slice(glob('/res/images/*.jpg'), 0, 999) as $filename)
is work fine but
foreach(array_slice(glob('/res/images/*.jpg'), 0, 1000) as $filename)
doesnt work. Where is I can change such limit?
foreach(array_slice(glob('/res/images/*.jpg'), 0, 999) as $filename)
is work fine but
foreach(array_slice(glob('/res/images/*.jpg'), 0, 1000) as $filename)
doesnt work. Where is I can change such limit?
Try with simple(May be the better) manner like
$i = 0;
foreach(glob('/res/images/*.jpg') as $filename) {
if($i++ <= 1000) {
// Do the display
} else {
break;
}
}
$i = 0;
$max = 1000;
foreach(array_slice(glob('/res/images/*.jpg'), 0, $max) as $filename) {
// Some code here
if($i++ >= $max) break;
}
Try this
Shortest Way to do like so.
$i = 0;
foreach(array_slice(glob('/res/images/*.jpg'), 0, 1000) as $filename) {
// Some code here
if($i++ >= 1000) break;
}
I hope it will be helpful.