有人有T_PAAMAYIM_NEKUDOTAYIM吗?
当前回答
编辑:不幸的是,从PHP 8.0开始,答案不再是“不,不再是”。这个RFC没有像我希望的那样被接受,建议将T_PAAMAYIM_NEKUDOTAYIM改为T_DOUBLE_COLON;但它被拒绝了。
注意:我保留这个答案是为了历史目的。实际上,由于RFC的创建和某些时候的投票比例,我创建了这个答案。另外,我保留这个,希望它在不久的将来被接受。
其他回答
这只是发生在我的字符串赋值使用双引号。我在一个POST变量上缺少一个右花括号…
" {$_POST['txtName']在$date";
应该是
{$_POST['txtName']} on $date";
我不能解释为什么。我的意思是,我看到了会破坏代码的错误,但我不明白为什么它引用了类错误。
从维基百科:
In PHP, the scope resolution operator is also called Paamayim Nekudotayim (Hebrew: פעמיים נקודתיים), which means “double colon” in Hebrew. The name "Paamayim Nekudotayim" was introduced in the Israeli-developed Zend Engine 0.5 used in PHP 3. Although it has been confusing to many developers who do not speak Hebrew, it is still being used in PHP 5, as in this sample error message: $ php -r :: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM As of PHP 5.4, error messages concerning the scope resolution operator still include this name, but have clarified its meaning somewhat: $ php -r :: Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)
来自PHP官方文档:
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class. When referencing these items from outside the class definition, use the name of the class. As of PHP 5.3.0, it's possible to reference the class using a variable. The variable's value can not be a keyword (e.g. self, parent and static). Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However, while writing the Zend Engine 0.5 (which powers PHP 3), that's what the Zend team decided to call it. It actually does mean double-colon - in Hebrew!
它是PHP中::操作符的名称。它的字面意思是“双冒号”。出于某种原因,他们用希伯来语命名它。检查你的代码语法,在适当的地方放一个::
我很懂希伯来语,所以为了澄清“Paamayim Nekudotayim”这个名字,转述的意思是“双冒号”,但按字面翻译:
"Paamayim"的意思是"两个"或"两次" “Nekudotayim”的意思是“点”(点亮)。“洞”) 在希伯来语中,nekuda的意思是一个点。 复数形式是nekudot,即圆点,它的作用是元音 它被称为Nekudo-tayim的原因是因为后缀“-ayim”也意味着“两次”或“两次”,因此::表示“两次,两个点”,或更常见的范围解析操作符。
编辑:不幸的是,从PHP 8.0开始,答案不再是“不,不再是”。这个RFC没有像我希望的那样被接受,建议将T_PAAMAYIM_NEKUDOTAYIM改为T_DOUBLE_COLON;但它被拒绝了。
注意:我保留这个答案是为了历史目的。实际上,由于RFC的创建和某些时候的投票比例,我创建了这个答案。另外,我保留这个,希望它在不久的将来被接受。
推荐文章
- 原则-如何打印出真正的sql,而不仅仅是准备好的语句?
- 如何从关联PHP数组中获得第一项?
- PHP/MySQL插入一行然后获取id
- 我如何排序一个多维数组在PHP
- 如何在PHP中截断字符串最接近于一定数量的字符?
- PHP错误:“zip扩展名和unzip命令都没有,跳过。”
- Nginx提供下载。php文件,而不是执行它们
- Json_encode()转义正斜杠
- 如何在PHP中捕获cURL错误
- 如何要求一个分叉与作曲家?
- 如何在php中创建可选参数?
- 在文本文件中创建或写入/追加
- 为什么PHP的json_encode函数转换UTF-8字符串为十六进制实体?
- 如何从一个查询插入多行使用雄辩/流利
- 在PHP单元测试执行期间,如何在CLI中输出?