Problems with strings in PHP (not adding two strings together properly)
if we say:
$termstringDomain1 = "something";
$url = "somethingelse";
$url = 'http://' . $termstr开发者_如何学GoingDomain1 . '/' . $url;
the result if gives me is: http:///somethingelse
instead of http://something/somethingelse
so basically it is ignoring $termstringDomain1
Any idea why?
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
.
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;
精彩评论