The normal way of looping through a directory is to get a handle on the directory, then go through each item, making sure that the file is readable and is not "." or ".." before doing something with the file. Because this is done a lot the DirectoryIterator() object was created in PHP5 to simplify this process.
The constructor of the DirectoryIterator() object takes a single parameter, this is the path of the directory that is to be iterated over.
$dir = new DirectoryIterator('/');
To get the current working directory you can use the PHP function getcwd(). This will return the directory that the PHP script is being run from.