Why do I need the isset() function in php?

后端 未结 6 1655
终归单人心
终归单人心 2021-01-04 06:27

I am trying to understand the difference between this:

if (isset($_POST[\'Submit\'])) { 
  //do something
}

and

if ($_POST[         


        
6条回答
  •  隐瞒了意图╮
    2021-01-04 07:23

    In your 2nd example, PHP will issue a notice (on E_NOTICE or stricter) if that key is not set for $_POST.

    Also see this question on Stack Overflow.

提交回复
热议问题