Escape HTML to PHP or Use Echo? Which is better?

前端 未结 13 726
无人共我
无人共我 2020-12-01 04:34

In terms of performance , what would be better. Using PHP to echo all the HTML output so I can pepper it with the various bits of working code and variables or escape HTML t

13条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 04:55

    This should be considered more of a readability and maintenance issue than a performance issue.

    Thus, option 2 has a couple concrete advantages:

    1. Code coloring. With option 1 everything is colored as an echo statement which makes reading HTML more difficult.
    2. Intellisense - With many IDE's, HTML within a PHP echo statement won't engage intellisense, so you'll be typing all that HTML by hand.

提交回复
热议问题