Weak typing in PHP: why use isset at all?

前端 未结 9 834
孤街浪徒
孤街浪徒 2020-12-01 12:38

It seems like my code works to check for null if I do

if ($tx) 

or

if (isset($tx))

why would I do the se

9条回答
  •  眼角桃花
    2020-12-01 13:33

    It also important to note that a string in PHP could be set but empty. So the isset would return true even though there is nothing in the string, to prevent this I use a function something like this to replace isset:

    
    

提交回复
热议问题