I recently moved some display logic from raw output into a class and I've found rather strange behavior.
The old code:
$foo = scandir('\css');
Behavior: as expected, got me results from the \css folder in my web root.
However, I am making a themes class and so I wanted to roll all that into a function
class someClass {
public function getCSS() {
$foo = scandir('\css');
}
}
That same code now generates an error, "The system cannot find the file specified. (code: 2) ". To test what was going on, I did the following:
print_r(scandir('/'));
Which gave me the directory listing for C:\, not my webroot. What is going on? I am using the latest verion of WAMP, and PHP 5.4.3
So apparently I can't spell. As @arkascha mentioned
$foo = scandir('\css');
should not be relative to my web root, the actual code was
$foo = scandir('css\');
which works as expected, obviously