My directory Structure is like
car_brands/AAA/alto.php
car_brands/BBB/figo.php
car_brands/CCC/beat.php
PHP Code
<?php
$dir = "Car_Brands";
$dh = opendir($dir);
while (false !== ($filename = readdir($dh)))
{
$files[] = $filename;
}
natcasesort($files);
foreach ($files as $file)
{
if($file!='.' && $file!='..')
{
echo $file;
}
}
?>
Like I want
<a href="Car_Brands/<?php echo $file; ?>/"here i want filename of particular folder"" class="btn btn-red" style="width:180px;height:50px;"><br/><?php echo $file; ?><br/></a>
By This code I can get folders under car_brands.like AAA,BBB,CCC but how can get the php filename under each folder in single foreach loop is there any easy way to do this.