Foser Posted July 2, 2007 Share Posted July 2, 2007 In some functions like mail there is a repeated variable. and most of them have .= like $var1 .= "text"; what does the .= mean? Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 caternation addingone.toanother <?PHP $a.="HELLO "; $a.=" THERE I AM"; $a.=" REDARROW"; echo $a; ?> Quote Link to comment Share on other sites More sharing options...
Foser Posted July 2, 2007 Author Share Posted July 2, 2007 so its like one big variable. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 there you go nearly right. http://karma.nucleuscms.org/item/27/catid/6 Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 2, 2007 Share Posted July 2, 2007 As we have already seen in the Echo Lesson, the period "." is used to add two strings together, or more technically, the period is the concatenation operator for strings. PHP Code: $a_string = "Hello"; $another_string = " Billy"; $new_string = $a_string . $another_string; echo $new_string . "!"; Display: Hello Billy! link http://www.tizag.com/phpT/operators.php Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 2, 2007 Share Posted July 2, 2007 The .= operator is handy if you have a loop running and want to repeatedly add something onto the end of a string. <?php $txt=''; for ($i=0;$i<5;$i++) { $txt.='*'; } echo $txt; ?> The above is exactly the same as this: <?php $txt=''; for ($i=0;$i<5;$i++) { $txt=$txt.'*'; } echo $txt; ?> All the above does is make a string containing "*****" (five stars) 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.