hgmme@wa Posted December 26, 2007 Share Posted December 26, 2007 I've come upon some code that uses .= for a comparison and I've got no clue what it does. So if someone could explain what does that'd be awesome. Link to comment Share on other sites More sharing options...
boen_robot Posted December 26, 2007 Share Posted December 26, 2007 That's no comparrison. That's concatenation assignment. That is, assign the value of a variable to be that variable, concatenated with the variable on the right.In other words, $var1 .= $var2; is the same as $va1 = $var1 . $var2; If used in a comparrison, like: if ($var1 .= $var2) then it would always evaluate to "true" unless $var2 in being concatenated with $var1 somehow resulted to a boolean false, and I'm not aware of any scenario where that would be possible. Link to comment Share on other sites More sharing options...
hgmme@wa Posted December 26, 2007 Author Share Posted December 26, 2007 Ok that makes sense. Thanks. Link to comment Share on other sites More sharing options...
coolgamer48 Posted December 26, 2007 Share Posted December 26, 2007 For any operator (e.g., +, -, *, /, .)$x operator= $ymeans:$x = $x operator &y.So, $x += $y is the same as $x = $x + $y, et cetera. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.