gpt4 book ai didi

php - 为什么@unset 给出解析错误?

转载 作者:可可西里 更新时间:2023-11-01 13:07:06 25 4
gpt4 key购买 nike

为什么在调用 unset 时不能使用 @ 运算符隐藏错误?以下导致解析错误:

@unset($myvar);

最佳答案

@ 运算符仅适用于表达式,unset 是一种语言构造,而不是函数。查看manual page了解更多信息:

Note: The @-operator works only on expressions. A simple rule of thumb is: if you can take the value of something, you can prepend the @ operator to it. For instance, you can prepend it to variables, function and include() calls, constants, and so forth. You cannot prepend it to function or class definitions, or conditional structures such as if and foreach, and so forth.

关于php - 为什么@unset 给出解析错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4675397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com