2

if we say:

$termstringDomain1 = "something";
$url = "somethingelse";
$url = 'http://' . $termstringDomain1 . '/' . $url;

the result if gives me is: http:///somethingelse instead of http://something/somethingelse

so basically it is ignoring $termstringDomain1 Any idea why?

6
  • 3
    This runs fine, your problem exists elsewhere in some code that you haven't pasted. Commented Jan 28, 2010 at 20:09
  • but how would it be somewhere else, all what I am doing is that above then (echo $url) Commented Jan 28, 2010 at 20:11
  • is that really your $termstringDomain1? maybe your actual variable value is borked Commented Jan 28, 2010 at 20:11
  • when I echo $termstringDomain1, it prints (something) on the screen so it is working ... Commented Jan 28, 2010 at 20:12
  • @unknown: Your problem is elsewhere. I just copied/pasted your code and could not repro the problem. Why type of server are you on? Which version of PHP? Commented Jan 28, 2010 at 20:13

2 Answers 2

2

I am unable to reproduce this issue:

$foo = "foo";
$bar = "bar";
$bar = "sayFoo: " . $foo . ", sayBar: " . $bar;
print $bar; // 'sayFoo: foo, sayBar: bar'

Your problem is likely elsewhere. If I copy/paste what you provided, I get the following:

http://something/somethingelse

Check your variable casing. $domain1 is not the same as $Domain1.

Sign up to request clarification or add additional context in comments.

Comments

1

Can you try putting echo infront of all the declarations, to try to track the problem down?

echo $termstringDomain1 = "something";
echo $url = "somethingelse";
echo $url = 'http://' . $termstringDomain1 . '/' . $url;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.