Php Code : How To Show Filenames Using Scandir
In this Php Tutorial we will Learn How To Use Scandir To Display Files Names From Folder Using Php .
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
Php Source Code:
<?php
$dir_path = "folder/";
if(is_dir($dir_path))
{
$files = scandir($dir_path);
print_r($files);
echo"<br>";
for($i = 0; $i < count($files); $i++)
{
if($files[$i] != '.' && $files[$i] != '..')
{
echo "File $i -> $files[$i]<br>";
}
}
}
1 comments:
comments"." - current directory
Reply".." - parent directory
What is the practical use of these dots? What happens when you remove them?