Module: appdb Branch: master Commit: 3a3863ccd269ad1bd7c5131ec383d0af21a6b743 URL: http://source.winehq.org/git/appdb.git/?a=commit;h=3a3863ccd269ad1bd7c5131ec...
Author: daoo daoo90@gmail.com Date: Fri Nov 23 22:18:36 2007 +0100
Update CODING_STANDARDS
---
CODING_STANDARD | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/CODING_STANDARD b/CODING_STANDARD index bba722d..d4fac23 100644 --- a/CODING_STANDARD +++ b/CODING_STANDARD @@ -97,3 +97,20 @@ function bar() 3) always put a single space after the comment mark
4) never use # for commenting as it will become obsolete in the future + +/** + * string quotes + */ +There are two different ways to quote strings in PHP - single quotes or double quotes. +The difference is that the parser does variable interpolation in double-quoted strings, but not in single quoted strings. +Because of this, always use single quotes unless the string contains a variable that needs to be parsed. + +Also if the string contains a variable put it inside double quotes instead of using 'bla' . $var . 'bla'; +To increase readability of the code. +Wrong: +$str = "This is a long string without any variables"; +$str = 'This string contains a variable ' . $var . ' enough said.'; + +Right: +$str = 'This is a long string without any variables'; +$str = "This string contains a variable $var enough said";