php iterate folder
// Shows us all files and directories in directory except "." and "..".
foreach (new DirectoryIterator('../moodle') as $fileInfo) {
if($fileInfo->isDot()) continue;
echo $fileInfo->getFilename() . "<br>\n";
}
php iterate folder
// Shows us all files and directories in directory except "." and "..".
foreach (new DirectoryIterator('../moodle') as $fileInfo) {
if($fileInfo->isDot()) continue;
echo $fileInfo->getFilename() . "<br>\n";
}
loop through files php
<?php
$folder = '/path/'; //directory or folder to loop through
$checkFiles = scandir($folder); //scan folder content
$fileCount = count($checkFiles); //count number of files in the directory
$i = 0; //set for iteration;
while($i < $fileCount){
$file = $checkFiles[$i]; //each file is stored in an array ...
if($file = '.' || $file = '..'){
//echo nothing
}else{
echo $file; // file names are printed out
}
}
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us