Jump to content

Concatenate a variable and a string into another variable


ziggelflex
 Share

Go to solution Solved by Zane,

Recommended Posts

I have this.

$root = './dir1';
$structure = .$root."./dir2/dir3/dir4/dir5/dir6";

and I want the

$structure

variable to contain

./dir1/dir2/dir3/dir4/dir5/dir6

Any help. I know this is very basic. So thanks in advance

Edited by ziggelflex
Link to comment
Share on other sites

You were close.

$structure = $root . "/dir2/dir3/dir4/dir5/dir6";

This line will take the contents of $root and append the string following the connecting dot.  Not sure why your starting value of $structure has a leading dot in it but you probably know.

Link to comment
Share on other sites

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.

 Share

×
×
  • 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.