Why check both isset() and !empty()

后端 未结 10 2531
难免孤独
难免孤独 2020-11-21 23:48

Is there a difference between isset and !empty. If I do this double boolean check, is it correct this way or redundant? and is there a shorter way

10条回答
  •  梦毁少年i
    2020-11-22 00:20

    The accepted answer is not correct.

    isset() is NOT equivalent to !empty().

    You will create some rather unpleasant and hard to debug bugs if you go down this route. e.g. try running this code:

    
    

    https://3v4l.org/J4nBb

提交回复
热议问题