Search the blog

When you use scandir to get all the files from a directory it includes . and ..; to get the files without the . and .. use this code.

$files = scandir('./');
$files = array_diff($files, ['.', '..']);
$files = array_values($files); // Makes the array index start at 0 rather than 2
Tim Bennett is a web designer and developer. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.