php - Limit in foreach?

967

I didnt found a solution for my problem. With the following code I scan files in a folder. I see only 601 entries. Is there any limit in foreach, select or scandir?

<?php
$ordner = "../picture/";
$alledateien = scandir($ordner);
sort($alledateien);
foreach ($alledateien as $datei) {
$dateiinfo = pathinfo($ordner."/".$datei);
$size = ceil(filesize($ordner."/".$datei)/1024); 
if ($datei != "." && $datei != ".."  && $datei != "_notes") { 
?>
<option value="<?php echo $dateiinfo['filename'] . "." . $dateiinfo['extension']; ?>"><?php echo $dateiinfo['filename']; ?> (<?php echo $dateiinfo['extension']; ?> | <?php echo $size ; ?>kb)</option>
<?php
}};
?> 
615

Answer

Solution:

start from

for($k=2;$k<count($alledateien);$k++){
$dateiinfo = pathinfo($ordner."/".$alledateien[$k]);
// .. Your Code
}

Limit is when the condition gets satisfies . Depends on you how you set it in a loop .

If you give aprint_r($alledateien) you will get to see two extra files. and.. , those arecurrent directory andparent directory. To ignore start the loop from 2.

People are also looking for solutions to the problem: passing parameters from view to controller php laravel

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.