mpacaon
07-31-2008, 09:08 AM
What does this assignment operator in PHP do?
.=
// Example
x.=y
.=
// Example
x.=y
|
||||
Assignment Operator .=mpacaon 07-31-2008, 09:08 AM What does this assignment operator in PHP do? .= // Example x.=y rangana 07-31-2008, 09:24 AM It's concatenation (http://phphowto.blogspot.com/2006/12/concatenate-strings.html). It does mean the same thing as: x=x.y Hope that makes sense. mpacaon 07-31-2008, 09:29 AM Uhm.. What does the "dot" thing do? Does it multiply the 2 variables? djm0219 07-31-2008, 10:06 AM The dot is the string concatenation operator. See this page (http://us3.php.net/manual/en/language.operators.string.php) of the PHP documentation for the complete details. The .= is referred to as the "concatenating assignment operator". abduraooft 07-31-2008, 10:19 AM Well, it's the shorthand assignment operator. a.=b is equivalent to a=a.b, similarly] a+=b is equivalent to a=a+b (See http://www.exforsys.com/tutorials/c-language/c-operators.html =>4. Assignment Operators ) ssonawa 07-31-2008, 10:37 AM In PHP, period is used for concatenating, joining two strings together. Consider following example, $a = "Hello "; $b = $a . "World!"; // now $b contains "Hello World!" $a = "Hello "; $a .= "World!"; // now $a contains "Hello World!" Hope your doubt has got cleared, refer php.net, great resource for PHP F1 :thumbsup: |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum