PHP: a short cut for isset and !empty?

后端 未结 11 2239
余生分开走
余生分开走 2021-02-09 13:45

I wonder if there any better ideas to solve the problem below,

I have a form with a number of input fields, such as,



        
11条回答
  •  半阙折子戏
    2021-02-09 14:29

    empty($var) is an abbreviation for !( isset($var) && $var ).

    So !empty($_POST['...']) will be sufficient for your situation — the isset call you have currently is redundant.

提交回复
热议问题