This question already has an answer here:
这个问题在这里已有答案:
- Reference — What does this symbol mean in PHP? 18 answers
参考 - 这个符号在PHP中意味着什么? 18个答案
We often use $class_object->class_procedure
or self::class_procedure
in PHP OOP. While reading aloud your code, how do you read out these conventions?
我们经常在PHP OOP中使用$ class_object-> class_procedure或self :: class_procedure。在大声朗读代码时,您如何阅读这些惯例?
4 个解决方案
#1
9
->
is the object operator. Typically called the arrow in conversation. If I were reading the code, I might say:
- >是对象运算符。通常称为对话中的箭头。如果我正在阅读代码,我可能会说:
class object arrow class method
类对象箭头类方法
::
is the static resolution operator. I doesn't read as well in conversation. The docs say double colon. I might say:
::是静态分辨率运算符。我在谈话中也没有读过。文件说双结肠。我可能会说:
class colon colon static method
class colon冒号静态方法
Note: Reading code aloud can be awkward regardless of how you name syntax. Furthermore, it will depend greatly on your audience. I am sharing what I've heard, seen used in books, or found in the docs.
注意:无论您如何命名语法,大声朗读代码都会很尴尬。此外,它将在很大程度上取决于您的受众。我正在分享我所听过的,在书中使用或在文档中找到的内容。
#2
4
You could use their token names:
您可以使用其令牌名称:
-
->
(Object Operator AKA Arrow) -
::
(Paamayim Nekudotayim OR Double Colon OR Static Object Operator)
- >(对象操作员AKA Arrow)
::(Paamayim Nekudotayim OR双冒号或静态对象操作员)
Or just say:
或者只是说:
[static] method X of object Y
对象Y的[静态]方法X.
#3
1
For the static version (self::class_procedure
), keep it simple.. "double colon"
对于静态版本(self :: class_procedure),保持简单..“双冒号”
#4
1
Class object's class procedure
类对象的类过程
Self's class procedure
自我的阶级程序
#1
9
->
is the object operator. Typically called the arrow in conversation. If I were reading the code, I might say:
- >是对象运算符。通常称为对话中的箭头。如果我正在阅读代码,我可能会说:
class object arrow class method
类对象箭头类方法
::
is the static resolution operator. I doesn't read as well in conversation. The docs say double colon. I might say:
::是静态分辨率运算符。我在谈话中也没有读过。文件说双结肠。我可能会说:
class colon colon static method
class colon冒号静态方法
Note: Reading code aloud can be awkward regardless of how you name syntax. Furthermore, it will depend greatly on your audience. I am sharing what I've heard, seen used in books, or found in the docs.
注意:无论您如何命名语法,大声朗读代码都会很尴尬。此外,它将在很大程度上取决于您的受众。我正在分享我所听过的,在书中使用或在文档中找到的内容。
#2
4
You could use their token names:
您可以使用其令牌名称:
-
->
(Object Operator AKA Arrow) -
::
(Paamayim Nekudotayim OR Double Colon OR Static Object Operator)
- >(对象操作员AKA Arrow)
::(Paamayim Nekudotayim OR双冒号或静态对象操作员)
Or just say:
或者只是说:
[static] method X of object Y
对象Y的[静态]方法X.
#3
1
For the static version (self::class_procedure
), keep it simple.. "double colon"
对于静态版本(self :: class_procedure),保持简单..“双冒号”
#4
1
Class object's class procedure
类对象的类过程
Self's class procedure
自我的阶级程序