php concatenation operator dot or comma?

This question already has an answer here:

  • Difference between period and comma when concatenating with echo versus return? 6 answers

  • It's . for Concatenation.

    Your code should to be as,

    $b = "HTML";
    $a = "test" . $b . "printing";
    echo $a;
    

    Output :

    testHTMLprinting
    

    For whitespace, you should use

    $b = "HTML";
    $a = "test" . " " . $b . " " . "printing";
    echo $a;
    

    Output :

    test HTML printing
    
    链接地址: http://www.djcxy.com/p/59066.html

    上一篇: 使用“,”PHP字符串连接?

    下一篇: PHP连接运算符点或逗号?