When do I use if/endif versus If{}?

后端 未结 6 884
暗喜
暗喜 2021-02-08 08:30

Well the question is self explanatory.

In PHP when do I use the if/endif notation instead of the standard if(something){} notation?

Exa

6条回答
  •  半阙折子戏
    2021-02-08 08:58

    I mostly use if/endif when stopping and starting the php code block in between, so nearly always when raw html is being outputted.

    For example:

    
    Lorem ipsum.
    
    

    This looks, at least in my opinion, better than the following:

    
    Lorem ipsum.
    
    

提交回复
热议问题