anolan13 Posted June 3, 2008 Share Posted June 3, 2008 Hello, For awhile now I've used code to get the size of a folders content (folder "files") on my server, this is the line that is now causing me trouble... $total = total_size('files/'); But now I want that folder to be a variable instead so maybe the folder is named "files" or "dogs" or "oranges" or anything...so I picture the new line of code being something like this $total = total_size('$files/'); Where $files is a variable, but it just wont work. I've tried everything, removing the ' 's ... the / I've played around with it for a long time and I get nothing. So how do I make this work? Any help is greatly appreciated, Thanks! Quote Link to comment Share on other sites More sharing options...
ikmyer Posted June 3, 2008 Share Posted June 3, 2008 try... $total = total_size("$files/"); Quote Link to comment Share on other sites More sharing options...
raku Posted June 3, 2008 Share Posted June 3, 2008 I'm not sure I understand what you're asking entirely, but you could try something like this: $files = "files/"; $total = total_size($files); Hope this helps. Quote Link to comment Share on other sites More sharing options...
mushroom Posted June 3, 2008 Share Posted June 3, 2008 I have found that some functions do not work with compound variables....... solution give the function a simple variable $files=$files."/"; $total = total_size('$files'); Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted June 3, 2008 Share Posted June 3, 2008 Variables surrounded by single quotes are not evaluated. This should work: <?php $total = total_size($files . '/'); ?> If that doesn't work, please show use the code for the total_size function. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.