Jump to content

[SOLVED] Put a variable in another variable somehow?


anolan13

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.