What is .= doing exactly?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oldcelt
Forum Newbie
Posts: 7
Joined: Wed Aug 10, 2011 5:29 am

What is .= doing exactly?

Post by oldcelt »

Code: Select all

$message .= "<h1>This is headline.</h1>";
This is one of the headers in some php email code intended for sending HTML.

I don't quite understand what the .= construct is doing. Can anyone help please?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: What is .= doing exactly?

Post by Celauran »

Concatenation and assignment.

Code: Select all

$string = "foo" . "bar";
// Same thing
$string = "foo";
$string .= "bar";
oldcelt
Forum Newbie
Posts: 7
Joined: Wed Aug 10, 2011 5:29 am

Re: What is .= doing exactly?

Post by oldcelt »

Ta very much!
priyankagound
Forum Commoner
Posts: 27
Joined: Thu Sep 19, 2013 2:53 am

Re: What is .= doing exactly?

Post by priyankagound »

Its Concatenation assignment ( .= ).

for example:-
$txt1 = "Developers"
$txt1 .= " Network"

Now $txt1 contains "Developers Network"

Hope i cleared your doubts.
Post Reply