foochuck Posted July 1, 2008 Share Posted July 1, 2008 My first variable is named $charlie and the second one is called $myBlog I would like to make $myBlog = $charlie and append the word info to my $charlie variable so that $myBlog = $charlieInfo; I'm not sure how to write this. I have tried: $myBlog = $charlie . "Info"; but that didn't turn out the way I was hoping. Could someone show me the correct syntax for this? Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/ Share on other sites More sharing options...
papaface Posted July 1, 2008 Share Posted July 1, 2008 Why do you want to do this? Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-579526 Share on other sites More sharing options...
revraz Posted July 1, 2008 Share Posted July 1, 2008 Use a real world example, the output you receive and the output you desire. Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-579528 Share on other sites More sharing options...
jonsjava Posted July 1, 2008 Share Posted July 1, 2008 not sure what you're asking. If you append data, like this: <?php $charlie = "charlie"; $myBlog = $charlie."info"; print $myBlog; ?> you get charlieinfo That, I know you understand. Next: If you rename the variable, so it becomes this: <?php $charlie = "charlie"; $myBlog = $charlieinfo; print $myBlog; ?> you'll get errors. So, Could you explain what it is that you're wanting? Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-579532 Share on other sites More sharing options...
.josh Posted July 1, 2008 Share Posted July 1, 2008 so...example: $charlie = "blah"; a) do you want it to literally say "$charlieinfo" b) do you want it to say "blahinfo" c) are you wanting to create a new variable called $charlieinfo? Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-579597 Share on other sites More sharing options...
foochuck Posted July 2, 2008 Author Share Posted July 2, 2008 c) are you wanting to create a new variable called $charlieinfo? so...example: $charlie = "blah"; a) do you want it to literally say "$charlieinfo" b) do you want it to say "blahinfo" c) are you wanting to create a new variable called $charlieinfo? Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-580010 Share on other sites More sharing options...
.josh Posted July 2, 2008 Share Posted July 2, 2008 okay...so, do you want $charlieinfo to have the same info as $charlie? Assuming you do.. $info = "info"; $charlie = "some piece of data"; $charlie.$info = $charlie; echo $charlieinfo; Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-580121 Share on other sites More sharing options...
foochuck Posted July 2, 2008 Author Share Posted July 2, 2008 Actually I have though of another way to do what I'm trying to do - but I still need help. I'm trying to pass a variable through a URL - using the get method - however I want to pass one variable another variables name and I'm not sure how to do this. $myVar = "This is it"; http://mysite.com?myBlog=myVar Basically in the end, I want $myBlog to be idential to $myVar (the string "This is it") okay...so, do you want $charlieinfo to have the same info as $charlie? Assuming you do.. $info = "info"; $charlie = "some piece of data"; $charlie.$info = $charlie; echo $charlieinfo; Link to comment https://forums.phpfreaks.com/topic/112834-variable-question/#findComment-580130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.