Home>

Currently, I am creating a coding standard for a development project using PHP, but I am worried about whether to unify the character string enclosure to single or double.
There are some examples of using them together, but I think it is more beautiful to unify them. (Personally, I'm a single sect)
I would like to know if there is a situation where you have to use double.

  • Answer # 1

    String

    Since the meanings are different, I don't think it is very appropriate to send one side by convention.
    Hmm. But if it is, will it be? .. ..
    But after all, it's case by case w

  • Answer # 2

    I would like to know if there is a situation where you have to use double.

    Special characters such as control codes\ ***Or\ u ***You can only specify in the double quotation mark in the format of.

  • Answer # 3

    There was an article like this for the time being.
    Understand the difference between PHP double quotes and single quotes

    It depends on me

    $str_value = "Yamada";
    echo'';


    I'm writing like this.

  • Answer # 4

    It used to be a single group, but now it's a techto group !?

    Maybe this is more of a character concatenation issue than a quote issue.
    If you want to unify this, you can do it, and if you don't, show the grounds for not doing it.

    If it is a single, it is troublesome to connect it, but the logic is easy to understand.
    If it is double, you can write it at once, but the embedded logic is hard to see.

    Of course there are many ways to do it, but ...

  • Answer # 5

    Personally, it's unaesthetic to put double quotes inside a single quote.

    Example

    <? php
    $img ='';
    // Not beautiful! (It is an individual view.
    $img = "";
    // congratulation !!!! (Personal view.

    personally,

    name which one
    HTML attributes Double quotation
    If there are double quotes in the string Double quotes (backslash just before double quotes in a string)
    When Japanese is in the character string other than the above Double quotation
    Character strings other than the above Single quotation