Specifying variables in a path
Posted: Wed Jan 03, 2007 1:34 pm
Weirdan | Please use
Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
I am relatively new to php and am running int a problem I can't seem to fins and answer to. I need to count the files in a directory. However, the directory will be a variable dependent on the page the user is on. If I hardcode a directory name into the path works, but when I place the variable int the path, it does not work.
I've tried every variaition I can think of. I'd hate to scrap this code as its so close to working. Any help would be hugely appreciated.Code: Select all
function num_files($directory='.') {
return count(glob($directory.'/_images/_projects/$project/*'));
}
$count = num_files();Weirdan | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]