search

Home  >  Q&A  >  body text

If you don't add any quotation marks after echo, you can also display text information. Why do you need to add single quotation marks? Is there any difference?

If you don’t add any quotation marks after echo, text information can also be displayed. Why do you need to add single quotation marks? Is there any difference?

搜扑互联搜扑互联1792 days ago1590

reply all(4)I'll reply

  • Smallink

    Smallink2020-02-27 16:14:31

    Single quotes support escaping but do not support output variables. According to the code format specifications, not adding quotes is not recognized. It will appear to others that you are not rigorous enough.

    reply
    0
  • Smallink

    Double quotes support escaping, variable output, and HTML tag output, for example: $str = "

    If I have to add a time in front of ***, I would like to do it immediately.

    "; echo $str;

    Smallink · 2020-02-27 16:17:34
  • 小可耐

    小可耐2020-02-12 12:41:03

    Single quotes: plain text. Double quotes: supports escaping such as \\ and outputs \. {$a} outputs the contents of variable $a=xxx.

    reply
    0
  • shure

    shure2020-02-02 22:44:28

    If there happens to be a string that is a constant, it is another matter

    reply
    1
  • Cancelreply