diff --git a/String-concatenation.md b/Strings.md similarity index 70% rename from String-concatenation.md rename to Strings.md index 73fbbfd..67860cf 100644 --- a/String-concatenation.md +++ b/Strings.md @@ -1,3 +1,25 @@ +PHP supports both single quote strings and double quote strings. For pure text you must use single quote strings for consistency. Double quote strings are only allowed for special characters (i.e. `"\n"`) or inlined variables (i.e. `"My name is {$name}"`); + +
Example

+ +**Bad** + +```PHP +echo "Hello World!"; +``` + +**Good** + +```PHP +echo 'Hello World!'; +``` + +

+ +_Reference_: [`Squiz.Strings.DoubleQuoteUsage`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/Sniffs/Strings/DoubleQuoteUsageSniff.php) + +*** + The concatenation operator should have one space on both sides in order to improve readability.
Example