chard Posted September 13, 2007 Share Posted September 13, 2007 Here's the format: $var1 = "" $var2 = "123" $var3 = "456" $var1 = $var1 + var2; Now that works fine. But when I do that again somewhere else $var1 = $var1 + $var3; The numbers inside the $var1 get scrambled and don't end up in 123456. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Aeglos Posted September 13, 2007 Share Posted September 13, 2007 $var1 = $var2 . $var3; That will give you $var1 = 123456. The point operator ( . ) joins two variables, the plus operator simply arithmeticaly adds them, as in: $var1 = 123+456 = 579 Quote Link to comment Share on other sites More sharing options...
marcus Posted September 13, 2007 Share Posted September 13, 2007 $var = 123; $var .= 456; echo $var; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.