I thought the period was used to append information to something in the previous line of a script?

For example:


echo 'Hello';
echo .' World';


Gave you "Hello World" -- both appearing on one line.

If you run that it will print 'Hello World' on one line, but it has nothing to do with the period. PHP don't automatically include any line breaks, so everything goes on one line unless you include some yourself. This can be confusing, because if the output is HTML, it will often be rendered on multiple lines even if the output is on one.

Doing
echo 'This is one <br /> line of output';
will produce one line of output but render as two lines of HTML. But doing
echo "This is one line /n";
echo "and this is another one";
will output two lines and render as one in HTML.

The period is string concatenation in PHP. $name = 'Jay' . ' ' . 'Mehaffey' sets $name to 'Jay Mehaffey'.

The echo command takes any number of values, seperated by commas, and outputs them.

Thus echo 'The time is now ',$time; and echo 'The time is now' . $time are actually doing two subtly different things. The first outputs 'The time is now' and then outputs $time right after it. The second puts 'The time is now' and $time together into one string and then outputs that.

Jay