Which is the best method to perform string concatenation in PHP?

前端 未结 4 1545
粉色の甜心
粉色の甜心 2021-01-19 03:26

In php we can append strings in many ways.

            Method 1
            ----------------------------
            $sql  = \"SELECT field1, \";
                    


        
4条回答
  •  日久生厌
    2021-01-19 04:06

    I vote for Method 3.

    The less concatenation operations, the better.

    Also, you should use single quotes as often as possible to avoid the PHP parser having to interpolate variables inside your strings.

提交回复
热议问题