jasonc Posted September 9, 2010 Share Posted September 9, 2010 I have seen somewhere that you can add to a string like so $var = "text"; or $string ="var"; &$var = "text"; it is the latter that I am wanting to know more about. Link to comment https://forums.phpfreaks.com/topic/212939-adding-to-a-string-value-using-var/ Share on other sites More sharing options...
petroz Posted September 9, 2010 Share Posted September 9, 2010 Never done it that way... I've always done.. Interested in seeing the other one your talking about.. $var = '1'; $var .= '2'; echo $var; //echo's 12 Link to comment https://forums.phpfreaks.com/topic/212939-adding-to-a-string-value-using-var/#findComment-1109075 Share on other sites More sharing options...
JasonLewis Posted September 9, 2010 Share Posted September 9, 2010 What you have provided is still incorrect, but if you're wondering about the ampersand then it's used for references. $foo = 'foo bar'; $bar = &$foo; $bar = 'bar foo'; echo $foo; // will output bar foo Link to comment https://forums.phpfreaks.com/topic/212939-adding-to-a-string-value-using-var/#findComment-1109077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.