PHP - To echo or not to echo?

前端 未结 7 1036
[愿得一人]
[愿得一人] 2021-01-31 06:05

What is more efficient and/or what is better practice, to echo the HTML or have many open and close php tags?

Obviously for big areas of HTML it is sensible

7条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 06:20

    PHP solves this problem by what is known as heredocs. Check it out please.

    Example:

      echo <<{$k}s
      {$v}/kg
    EOD;
    

    Note: The heredoc identifer (EOD in this example) must not have any spaces or indentation.

提交回复
热议问题