PHP 需要 T_PAAMAYIM_NEKUDOTAYIM?
有人有 T_PAAMAYIM_NEKUDOTAYIM
吗?
Does anyone have a T_PAAMAYIM_NEKUDOTAYIM
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有人有 T_PAAMAYIM_NEKUDOTAYIM
吗?
Does anyone have a T_PAAMAYIM_NEKUDOTAYIM
?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(11)
它是双冒号运算符
::
(请参阅解析器标记列表)。It’s the double colon operator
::
(see list of parser tokens).希伯来语表示“双冒号”。
It's Hebrew for "double colon".
它是 PHP 中
::
运算符的名称。 它的字面意思是“双冒号”。 由于某种原因,他们用希伯来语命名它。 检查您的代码语法,并在适当的地方添加::
:-)It’s a name for the
::
operator in PHP. It literally means "double colon". For some reason they named it in Hebrew. Check your code syntax, and put a::
where appropriate :-)来自维基百科:
来自官方 PHP 文档:
From Wikipedia:
From the official PHP documentation:
我很懂希伯来语,所以为了向您澄清“Paamayim Nekudotayim”这个名字,释义的意思是“双冒号”,但按字面翻译:
::
表示“两个”次,两个点”,或更常见的名称是范围解析运算符。I know Hebrew pretty well, so to clarify the name "Paamayim Nekudotayim" for you, the paraphrased meaning is "double colon", but translated literally:
::
denotes "two times, two dots", or more commonly known as the Scope Resolution Operator.当您将 PHP 中的常量应用于 empty() 函数时,也会出现这种情况:
这就是我的情况。 我用这个解决了它:
This is also coming when you apply a constant in PHP to the empty() function:
That was my case. I solved it by using this:
编辑:不幸的是,从 PHP 8.0 开始,答案不再“不,不再”。 此 RFC 未如我所愿被接受,建议更改
T_PAAMAYIM_NEKUDOTAYIM
至T_DOUBLE_COLON
; 但遭到拒绝。注意:我保留这个答案是出于历史目的。 实际上,由于 RFC 的创建和某个时刻的投票比例,我创建了这个答案。 另外,我保留这个是为了希望它在不久的将来能被接受。
Edit: Unfortunately, as of PHP 8.0, the answer is not "No, not anymore". This RFC was not accepted as I hoped, proposing to change
T_PAAMAYIM_NEKUDOTAYIM
toT_DOUBLE_COLON
; but it was declined.Note: I keep this answer for historical purposes. Actually, because of the creation of the RFC and the votes ratio at some point, I created this answer. Also, I keep this for hoping it to be accepted in the near future.
当使用以下命令时,这可能会发生在 foreach 上:
而不是
This can happen on foreachs when using:
instead of
对我来说,这发生在类函数中。
在 PHP 5.3 及以上版本
$this::$defaults
工作正常; 当我将代码交换到服务器时,由于某种原因,该服务器的版本号较低,它引发了此错误。就我而言,解决方案是使用关键字
self
而不是$this
:self::$defaults
工作得很好。For me this happened within a class function.
In PHP 5.3 and above
$this::$defaults
worked fine; when I swapped the code into a server that for whatever reason had a lower version number it threw this error.The solution, in my case, was to use the keyword
self
instead of$this
:self::$defaults
works just fine.这只是在使用双引号的字符串赋值中发生在我身上。 我缺少 POST 变量上的结束卷曲...
"for {$_POST['txtName'] on $date"
;应该是
“for {$_POST['txtName']} on $date”
;我无法解释为什么。 我的意思是,我看到了会破坏代码的错误,但我不明白为什么它引用了类错误。
This just happened to me in a string assignment using double quotes. I was missing a closing curly on a POST variable...
"for {$_POST['txtName'] on $date"
;should have been
"for {$_POST['txtName']} on $date"
;I can't explain why. I mean, I see the error that would break the code but I don't see why it references a class error.
这只是在 foreach 循环中发生在我身上。 我无意中输入了
($array as $key as $value)
,而 PHP 拒绝了第一个as
。This just happened to me in a foreach loop. I had inadvertently typed
($array as $key as $value)
and PHP objected to the firstas
.