| Version 1 (modified by peter, 3 years ago) |
|---|
Always use a space between the dot and the concatenated parts to improve readability.
<?php $string = 'Foo' . $bar; $string = $bar . 'foo'; $string = bar() . 'foo'; $string = 'foo' . 'bar'; ?>
When you concatenate simple variables, you can use double quotes and add the variable inside; otherwise, use single quotes.
<?php $string = "Foo $bar"; ?>
When using the concatenating assignment operator ('.='), use a space on each side as with the assignment operator:
<?php $string .= 'Foo'; $string .= $bar; $string .= baz(); ?>
