'At' symbol before variable name in PHP: @$_POST

前端 未结 4 2038
梦谈多话
梦谈多话 2020-12-03 00:34

I\'ve seen function calls preceded with an at symbol to switch off warnings. Today I was skimming some code and found this:

$hn = @$_POST[\'hn\'];

4条回答
  •  隐瞒了意图╮
    2020-12-03 01:05

    All that means is that, if $_POST['hn'] is not defined, then instead of throwing an error or warning, PHP will just assign NULL to $hn.

提交回复
热议问题