From 3d49fb02176e54cfced74fdafd1c002156b0ad8d Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Mon, 5 Nov 2018 13:16:20 +0100 Subject: [PATCH] Updated String concatenation (markdown) --- String-concatenation.md => Strings.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) rename String-concatenation.md => Strings.md (70%) 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