what is this .= ?
Moderator: General Moderators
-
runrunforest
- Forum Newbie
- Posts: 6
- Joined: Thu Sep 18, 2008 10:33 pm
what is this .= ?
this .= happened toappear between two strings. I don't know what it means.
Re: what is this .= ?
It's the concatenation operator. Essentially it means "add the content of this string on to the previous string".
Re: what is this .= ?
Example:
<?php
$a = 3;
$a += 5; // sets $a to 8, as if we had said: $a = $a + 5;
$b = "Hello ";
$b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
echo $b;
?>
Hope its a continuation of the previous result of the variable. Here the output will be
Hello There!
The above expamle may help you better..
<?php
$a = 3;
$a += 5; // sets $a to 8, as if we had said: $a = $a + 5;
$b = "Hello ";
$b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
echo $b;
?>
Hope its a continuation of the previous result of the variable. Here the output will be
Hello There!
The above expamle may help you better..
-
runrunforest
- Forum Newbie
- Posts: 6
- Joined: Thu Sep 18, 2008 10:33 pm
Re: what is this .= ?
only apply for strings ?
Re: what is this .= ?
Try it and see.runrunforest wrote:only apply for strings ?
Re: what is this .= ?
Better yet, read the manual. Syntax questions are best answered by a fast search at the appropriate documentation web site.
PHP: http://www.php.net/docs.php
MySQL: http://dev.mysql.com/doc/
HTML, Javascript, CSS: http://w3schools.com/
PHP: http://www.php.net/docs.php
MySQL: http://dev.mysql.com/doc/
HTML, Javascript, CSS: http://w3schools.com/