isset vs empty vs is_null

后端 未结 14 2141
野的像风
野的像风 2020-11-29 08:34

I\'m trying to write a script that when a user uploads a file and does not enter a name an error is returned. I\'ve tried using is_null, empty, and isset and they all do not

14条回答
  •  时光取名叫无心
    2020-11-29 08:40

    Ref this: different between isset, is_null, empty in PHP

    • isset() mean $var is defined and not null
    • is_null() mean $var is defined and null. throw an error if it is undefined.
    • empty() is anything mean NO => false, 0, 0.0, "", "0", null, array()

提交回复
热议问题