milesdriven
07-27-2012, 09:32 PM
I'm trying to learn how the period "." works. Sometimes its concatenation, sometimes its echoed to the browser.
I'm trying to add a string, such as:
'_string'
...to a set of variables, such as:
$M3 = 'May';
$hi = '1';
$Y = '2012';
To get this:
"May12012_string" ( or with single quotes )
I asked this question before, and got an answer, but I can't get it to work anymore. For example, this:
$time = ".$M3.$hi.$Y.";
echo $time;
Shows up as this in the browser:
.Jul.11.2012.
This:
$time = '".$M3.$hi.$Y."8AM';
echo $time;
Sends this to the browser:
".$M3.$hi.$Y."8AM
This brings the variables together like I want:
$time = "$M3$hi$Y";
echo $time;
Sends this to the browser:
May12012
But adding a string to it like this:
$time = '"$M3$hi$Y"8AM'
echo $time;
Sends this to the browser:
"$M3$hi$Y"8AM
What is the difference between this (when is this necessary?):
".$M3."
and this:
"$M3"
I hope I asked the question clearly.
Thanks for your help.
I'm trying to add a string, such as:
'_string'
...to a set of variables, such as:
$M3 = 'May';
$hi = '1';
$Y = '2012';
To get this:
"May12012_string" ( or with single quotes )
I asked this question before, and got an answer, but I can't get it to work anymore. For example, this:
$time = ".$M3.$hi.$Y.";
echo $time;
Shows up as this in the browser:
.Jul.11.2012.
This:
$time = '".$M3.$hi.$Y."8AM';
echo $time;
Sends this to the browser:
".$M3.$hi.$Y."8AM
This brings the variables together like I want:
$time = "$M3$hi$Y";
echo $time;
Sends this to the browser:
May12012
But adding a string to it like this:
$time = '"$M3$hi$Y"8AM'
echo $time;
Sends this to the browser:
"$M3$hi$Y"8AM
What is the difference between this (when is this necessary?):
".$M3."
and this:
"$M3"
I hope I asked the question clearly.
Thanks for your help.