Check if variable is set and then echo it without repeating?

前端 未结 3 825
眼角桃花
眼角桃花 2021-02-13 21:48

Is there a concise way to check if a variable is set, and then echo it without repeating the same variable name?

Instead of this:



        
3条回答
  •  半阙折子戏
    2021-02-13 22:19

    Use isset function of php like this:

    variable) ? $this->variable : "variable not set";
    
     ?>
    

    i think this will help.

提交回复
热议问题