2

If I want to say

Hello
World

, would recommend to use ' (Apostrophe) or " (Quotation mark)?
Example:

<?php
$apostrophe = 'Hello' . "\n" . 'World!';

$quotation_mark = "Hello\nWorld!";

$newline = 'Hello
World!';

echo (($apostrophe == $quotation_mark) && ($apostrophe == $newline));

Output: 1 (True)

Sean Wei
  • 7,433
  • 1
  • 19
  • 39
  • 1
    http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php – Martin Feb 21 '16 at 01:31
  • Whatever you like really, just try to avoid mixing different styles all over the code. Quotes look cleaner to me. There might be some overhead from concatenation, but it is most likely negligible. – Elhana Feb 21 '16 at 01:31

1 Answers1

2

What do you think about this

$text = 'Hello' . PHP_EOL
      . 'World!';

In my opinion this is well readable The difference between the quotatation marks is easy. A String with the double quotatation mark is parsed for variables and special values, the other not.