相关疑难解决方法(0)

严格标准:只应通过引用传递变量

$el = array_shift($instance->find(..))
Run Code Online (Sandbox Code Playgroud)

上面的代码以某种方式报告了严格的标准警告,但这不会:

function get_arr(){
    return array(1,2);
}
$el = array_shift(get_arr());
Run Code Online (Sandbox Code Playgroud)

那么它什么时候会报告警告呢?

php reference strict

81
推荐指数
3
解决办法
16万
查看次数

E_ALL的重点是什么?E_STRICT如果它与E_ALL的值相同?

  • E_ALL等于8191(0001 1111 1111 1111)
  • E_STRICT等于2048(0000 1000 0000 0000)

使用按位OR组合它们:

1 1111 1111 1111
  1000 0000 0000
Run Code Online (Sandbox Code Playgroud)

我们得到与原始值完全相同的E_ALL:

1 1111 1111 1111
Run Code Online (Sandbox Code Playgroud)

什么是做的点error_reporting(E_ALL | E_STRICT),如果我们可以简单做error_reporting(E_ALL)来获得同样的事情?

php error-reporting

11
推荐指数
1
解决办法
7994
查看次数

标签 统计

php ×2

error-reporting ×1

reference ×1

strict ×1