Link to home
Start Free TrialLog in
Avatar of jaxbrian
jaxbrian

asked on

readdir() question

I am trying to use the readdir() function to read all the content of a folder so I can display the images like in the code below. when i use this function it always gives me a " . " and a " .. "   How do I not include them in the results?
thanks for any help with this


B
$dir = opendir("photos/food");
while (($file = readdir($dir)) !== false)
  {
echo   "<a href=\"photos/food/" . $file . "\"" . "rel=\"lightbox[vacation1]\" title=\"\">
            <img src=\"photos/food/" . $file . "\"" . "alt=\"\" height=\"50px\" width=\"50px\"/>
          </a>";
  }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of nrbreen
nrbreen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jaxbrian
jaxbrian

ASKER

thank you very much, do you think you could explain a little bit about <>? if not maybe a link to where I can read about it.

if ($file<>'.' && $file<>'..')

is
  if  ( $file    is not equal to   '.'    and     $file     is not equal to     '..'  )