I know that what .= does, but does it improve performance/speed?
I mean, can't you just do
$message = "<html>
<head>
ect ect";
instead of
$message = "<html>";
$message .= "<head>";
$message .= "ect ect";
What's the difference, and which is better/more user-end friendly?
about $message .= "xxx";
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
It's generally used in this scenario.
Code: Select all
$message .= 'Hello';
if (isset($somevar))
{
$message .= ' And Salutations';
}
$message .= ' And Googbye';its the same thing...
its more coder friendly if you use it like you have in your post. its used so you can see what you putting in there better or if you have a situation like this
the output would be:
If you're me: Hi, PrObleM you are a god amongst men oh and have a nice day.
if you're not me: Hi, who the hell are you? oh and have a nice day.
its more coder friendly if you use it like you have in your post. its used so you can see what you putting in there better or if you have a situation like this
Code: Select all
$message = 'Hi, ';
if($name == '*PrObLeM*') {
$message .= "PrObleM you are a god amongst men ";
} else {
$message .= "who the hell are you?";
}
$message .= ' oh and have a nice day';If you're me: Hi, PrObleM you are a god amongst men oh and have a nice day.
if you're not me: Hi, who the hell are you? oh and have a nice day.