File not echo-ing what it should be

So the following is a script that should echo the name of the files in the directory , but when I run the script of my server here ( all I see is a blank page.

Does anyone know why this is occurring and how to fix it?

$dir = "";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            echo "filename: $file";

I would appreciate any and all help!

Thanks in Advance & Best Regards,

This may spark an idea

That is another way to do something similar, but I am trying to echo the names of the files not the paths to them.

$dir = “”;


$dir = “/path/on/your/server/websites/”;

OR a path relative to the folder this script is called from:

$dir = “…/files/”;

OR same folder:

$dir = “./”;

ah, so i can’t use a url then?