Page 1 of 1
about $message .= "xxx";
Posted: Fri Feb 04, 2005 9:30 am
by hunterhp
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?
Posted: Fri Feb 04, 2005 9:33 am
by John Cartwright
It's generally used in this scenario.
Code: Select all
$message .= 'Hello';
if (isset($somevar))
{
$message .= ' And Salutations';
}
$message .= ' And Googbye';
Posted: Fri Feb 04, 2005 9:37 am
by PrObLeM
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
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';
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.