I just can't get this to work what is wrong here?
$files = scandir('gallery/');
if ($files !== false)
{
foreach($files as $f) {
if ($f == '..' || $f == '.')
continue;
echo '<li><img src="gallery/'.$f.'" alt="'.$f.'" title=""></li>'."\n";
}
}
the folder is in my root folder named "gallery". The images are inside..
I always get this error:
Warning: Invalid argument supplied for foreach() in "MYDOCUMENT.PHP" on line 101.
var_dump($files);?$files = scandir('gallery/');putvar_dump($files); die();and run the code. Give us the output.glob().$files = glob('gallery/*.{jpeg,gif,png}', GLOB_BRACE);is_array($files)and the tryforeach