What do you call this arrow looking ->
operator found in PHP?
在PHP中找到的这个箭头是什么?
It's either a minus sign, dash or hyphen followed by a greater than sign (or right chevron).
它可以是一个负号,破折号或者连字符后面跟着一个大于号(或者右雪佛龙)。
How do you pronounce it when reading code out loud?
当你大声读代码的时候,你怎么发音?
16 个解决方案
#1
128
The official name is "object operator" - T_OBJECT_OPERATOR. I call it "arrow".
正式名称是“对象操作符”- T_OBJECT_OPERATOR。我把它叫做“箭头”。
#2
49
I call it "dart"; as in $Foo->bar()
: "Foo dart bar"
我把它叫做“飞镖”;如$Foo->bar():“Foo dart bar”
Since many languages use "dot" as in Foo.bar();
I wanted a one-syllable word to use. "Arrow" is just too long-winded! ;)
因为许多语言都使用“点”,如在页脚。bar()中;我想要一个单音节的词。“绿箭”太啰嗦了!,)
Since PHP uses .
"dot" for concatenation (why?) I can't safely say "dot" -- it could confuse.
由于PHP使用。“点”的连接(为什么?)我不能说“点”——它可能会混淆。
Discussing with a co-worker a while back, we decided on "dart" as a word similar enough to "dot" to flow comfortably, but distinct enough (at least when we say it) to not be mistaken for a concatenating "dot".
不久前,我们与一位同事讨论了一下,我们决定用“dart”这个词,这个词与“dot”(点)很相似,让人感觉很舒服,但又足够清晰(至少在我们说这个词的时候),不会被误认为是连接在一起的“dot”(点)。
#3
39
When reading PHP code aloud, I don't pronounce the "->" operator. For $db->prepare($query);
I mostly say "Db [short pause] prepare query." So I guess I speak it like a comma in a regular sentence.
当大声读PHP代码时,我不会读“->”操作符。美元$ db - >准备(查询);我通常说“Db [short pause] preparequery”。所以我猜我在一般的句子里说的是一个逗号。
The same goes for the Paamayim Nekudotayim ("::").
Paamayim Nekudotayim(“:”)也是如此。
#4
14
When reading the code to myself, I think of it like a "possessive thing".
当我读代码给自己听的时候,我认为它是“占有性的东西”。
For example:
例如:
x->value = y->value
would read "x's value equals y's value"
x的值等于y的值
#5
9
Most often, I use some variation on @Tor Valamo's method ("the B method of A" or "A's B method"), but I sometimes say "dot". E.g. "call A dot B()".
我经常使用@Tor Valamo方法的一些变体(“A的B方法”或“A的B方法”),但我有时会说“dot”。如。“叫A点B()”。
#6
4
Property operator.
房地产运营商。
When reading $a->b()
or $a->b
loud I just say "call b on the $a obj" or "get b from/in/of $a"
当我大声读$a->b()或$a->b时,我只会说"在$a obj上呼叫b "或"从/in/of $a"
#7
4
Harkening back to the Cobol 'in' where you would say "Move 5 to b in a." Most languages today qualify things the other direction.
回到Cobol语言“in”中,你会说“在a中移动5到b”。今天的大多数语言把事情限定在另一个方向上。
Yet I would still read $a->b();
as "Call b in a".
但我还是会读$a->b();如“在a中调用b”。
#8
4
$a->b
I call as "param b of $a".
我称之为“a $ b”。
$a->b()
I call as "function b of $a".
我称之为"函数b ($a) "
#9
3
I personally like to be verbose in expressing my code verbally.
我个人喜欢用冗长的语言表达我的代码。
e.g.:
例如:
$foo = new Foo();
echo $foo->bar
would read as such:
是这样读的:
echo(/print) the bar property of object foo.
echo(/print)对象foo的bar属性。
It's verbose and more time consuming, but I find if there is a reason for me to be expressing my code verbally, then I probably need to be clear as to what I'm communicating exactly.
它冗长而耗时,但我发现如果我有理由口头表达我的代码,那么我可能需要弄清楚我到底在交流什么。
#10
2
The single arrow can easily be referred verbally as what it means for PHP OOP: Member. So, for $a->var
you would say "Object a's member var".
单箭头很容易被口头称为PHP OOP: Member的含义。对于$a->var你会说"对象a的成员var"
When reading code aloud, it does help to read ahead (lookahead reference, sorry), and know what you may actually be referring to. For instance, let's have the following bit of code:
当你大声朗读代码的时候,它会帮助你提前阅读(看前面的参考资料,对不起),并且知道你实际上指的是什么。例如,让我们有以下代码:
<?php
Class MyClass {
$foo = 0;
public function bar() {
return $this->foo;
}
}
$myobject = new MyClass();
$myobject->bar();
?>
So, if I were to read aloud this code block as a demonstration of code, I would say this:
所以,如果我大声读这个代码块作为代码演示,我会说:
"Define Class 'MyClass', open-brace. Variable 'foo' equals zero, terminate line. Define public function 'bar' open-close parentheses, open-brace. Return member variable 'foo' of object 'this', terminate line. Close-brace, close-brace. Instantiate new instance of 'MyClass' (no arguments) as variable object 'myobject', terminate line. Call member method 'bar' of object 'myobject', terminate line."
“定义类的MyClass’,open-brace。变量foo等于零,终止行。定义公共函数'bar'开闭括号,开括号。返回对象'this'的成员变量'foo',终止行。Close-brace Close-brace。实例化“MyClass”(无参数)的新实例为变量对象“myobject”,终止行。调用对象'myobject'的成员方法'bar',终止行。
However, if I were reading the code aloud for other students or programmers to copy without a visual, then I would say:
但是,如果我大声朗读代码,让其他学生或程序员在没有视觉效果的情况下复制,我会说:
"PHP open tag (full), newline, indent, Class MyClass open-brace, newline. Indent, ['dollar-sign' | 'Object-marker'] foo equals 0, semicolon, newline, newline. public function bar open-close parentheses, open-brace, newline. Indent, return ['dollar-sign' | 'Object-marker'] this arrow foo, semicolon, newline. Reverse-indent, close-brace, newline, reverse-indent, close-brace, newline, newline. ['dollar-sign' | 'Object-marker'] myobject equals new MyClass open-close parentheses, semicolon, newline. ['dollar-sign' | 'Object-marker'] myobject arrow bar open-close parentheses, semicolon, newline. Reverse-indent, PHP close tag."
“PHP打开标签(完整),换行,缩进,MyClass类开括号,换行。缩进,['dollar-sign' | 'Object-marker'] foo = 0,分号,换行,换行。公用功能条开闭圆括号,开撑,换行。缩进,返回这个箭头foo,分号,换行。反缩进,近支撑,换行,反缩进,近支撑,换行,换行。['美元符号' | 'Object-marker'] myobject等于新的MyClass开合圆括号,分号,换行。['dollar-sign' | 'Object-marker'] myobject箭头条开闭圆括号,分号,换行。Reverse-indent,PHP标签。”
Where you see ['dollar-sign' | 'Object-marker'], just choose whichever you tend to speak for '$', I switch between the two frequently, just depends on my audience.
当你看到['dollar-sign' | 'Object-marker'],只要选择你想说$的那个词,我就会频繁地在这两个词之间切换,这取决于我的观众。
So, to sum it up, in PHP, -> refers to a member of an object, be it either a variable, another object, or a method.
总之,在PHP中,>指的是对象的成员,它可以是变量,也可以是对象,也可以是方法。
#11
1
The senior PHP developer where I work says "arrow".
我工作的高级PHP开发人员说“arrow”。
$A->B;
When he's telling me to type the above, he'll say, "Dollar A arrow B" or for
当他告诉我输入上面的内容时,他会说“$ A arrow B”或“for”
$A->B();
"Dollar A arrow B parens."
“一美元一箭B分。”
#12
1
I would do it like this:
我会这样做:
//Instantiated object variable with the name mono call property name
$mono->name;
//Instantiated object variable with the name mono call method ship
$mono->ship();
In my book (PHP Master by Lorna Mitchell) it's called the object operator.
在我的书中(Lorna Mitchell的PHP大师),它被称为对象操作符。
#13
0
Object. So $a->$b->$c
would be 'A object B object c'.
对象。因此,$a->$b->$c将是“一个对象b对象c”。
#14
0
->
is the property operator used for PHP in objected-oriented mode.
->是在面向对象的模式中用于PHP的属性操作符。
#15
0
user187291 has answered the non-subjective question, as for the subjective one, I say "sub". For example, I would pronounce $x->y
as "x sub y" - "sub" in this context is short for "subscript". This is more appropriate for array notation; $x['y']
I also pronounce "x sub y". Typically when reading code out loud, I am using my words to identify a line the other developer can see, so the ambiguity has yet to become a problem. I believe the cause is that I view structs/objects and arrays as "collections", and elements thereof are subscripted as in mathematical notation.
user187291已经回答了非主观性问题,至于主观性问题,我说sub。例如,我将$x->y读音为“xsub - y”-“sub”在此上下文中是“subscript”的缩写。这更适用于数组表示法;$x['y']我也发“xsub - y”的音。通常在大声读代码时,我用我的词来识别其他开发人员可以看到的一行,所以这种模糊性还没有成为一个问题。我认为原因在于我把结构体/对象和数组视为“集合”,而它们的元素以数学表示法的形式被加下标。
#16
0
Japanese has a convenient particle for this, "no" (の). It is the possessive particle, meaning roughly "relating to the preceding term".
日本有一个方便的粒子,“不”(の)。它是所有格粒子,意思大致是“与前一项有关”。
"Fred の badger" means "Fred's badger".
“弗雷德の獾”意味着“弗雷德的獾”。
Which is a long way round of saying that at least mentally, and also amongst those who understand Japanese, I tend to differentiate them by reading them as:
这是很长的一段话,至少在精神上,在懂日语的人当中,我倾向于通过阅读来区分他们:
$A->B(); // "Call $A's B."
C::D(); // "Call C の D."
But reading both as a possessive "'s" works too, for non-Japanese speakers. You can also flip them and use "of", so "D of C"... but that's kinda awkward, and hard to do it you're reading rapidly because it breaks your linear flow.
但是,对于非日语的人来说,阅读这两个词都是占有的“s”。你也可以翻转它们并用of,所以D (C)但这有点尴尬,很难做到你读得很快因为它破坏了你的线性流动。
If I were dictating, though, perhaps when pair coding and suggesting what to type, I'd refer to the specific characters as "dash-greater-than arrow" and "double-colon" (if i know the person I'm talking to is a PHPophile, I might call that a "paamayim nekudotayim double-colon" the first time, partly because it's a cool in-joke, partly to prevent them from "correcting" me).
如果我是口述,不过,也许当一对编码和暗示什么类型,我指的是特定的字符“dash-greater-than箭头”和“双冒号”(如果我知道我说的人是PHPophile,我可能会称之为“paamayim nekudotayim双冒号”第一次,部分原因是它是一个很酷的开玩笑,部分是为了防止“纠正”我)。
#1
128
The official name is "object operator" - T_OBJECT_OPERATOR. I call it "arrow".
正式名称是“对象操作符”- T_OBJECT_OPERATOR。我把它叫做“箭头”。
#2
49
I call it "dart"; as in $Foo->bar()
: "Foo dart bar"
我把它叫做“飞镖”;如$Foo->bar():“Foo dart bar”
Since many languages use "dot" as in Foo.bar();
I wanted a one-syllable word to use. "Arrow" is just too long-winded! ;)
因为许多语言都使用“点”,如在页脚。bar()中;我想要一个单音节的词。“绿箭”太啰嗦了!,)
Since PHP uses .
"dot" for concatenation (why?) I can't safely say "dot" -- it could confuse.
由于PHP使用。“点”的连接(为什么?)我不能说“点”——它可能会混淆。
Discussing with a co-worker a while back, we decided on "dart" as a word similar enough to "dot" to flow comfortably, but distinct enough (at least when we say it) to not be mistaken for a concatenating "dot".
不久前,我们与一位同事讨论了一下,我们决定用“dart”这个词,这个词与“dot”(点)很相似,让人感觉很舒服,但又足够清晰(至少在我们说这个词的时候),不会被误认为是连接在一起的“dot”(点)。
#3
39
When reading PHP code aloud, I don't pronounce the "->" operator. For $db->prepare($query);
I mostly say "Db [short pause] prepare query." So I guess I speak it like a comma in a regular sentence.
当大声读PHP代码时,我不会读“->”操作符。美元$ db - >准备(查询);我通常说“Db [short pause] preparequery”。所以我猜我在一般的句子里说的是一个逗号。
The same goes for the Paamayim Nekudotayim ("::").
Paamayim Nekudotayim(“:”)也是如此。
#4
14
When reading the code to myself, I think of it like a "possessive thing".
当我读代码给自己听的时候,我认为它是“占有性的东西”。
For example:
例如:
x->value = y->value
would read "x's value equals y's value"
x的值等于y的值
#5
9
Most often, I use some variation on @Tor Valamo's method ("the B method of A" or "A's B method"), but I sometimes say "dot". E.g. "call A dot B()".
我经常使用@Tor Valamo方法的一些变体(“A的B方法”或“A的B方法”),但我有时会说“dot”。如。“叫A点B()”。
#6
4
Property operator.
房地产运营商。
When reading $a->b()
or $a->b
loud I just say "call b on the $a obj" or "get b from/in/of $a"
当我大声读$a->b()或$a->b时,我只会说"在$a obj上呼叫b "或"从/in/of $a"
#7
4
Harkening back to the Cobol 'in' where you would say "Move 5 to b in a." Most languages today qualify things the other direction.
回到Cobol语言“in”中,你会说“在a中移动5到b”。今天的大多数语言把事情限定在另一个方向上。
Yet I would still read $a->b();
as "Call b in a".
但我还是会读$a->b();如“在a中调用b”。
#8
4
$a->b
I call as "param b of $a".
我称之为“a $ b”。
$a->b()
I call as "function b of $a".
我称之为"函数b ($a) "
#9
3
I personally like to be verbose in expressing my code verbally.
我个人喜欢用冗长的语言表达我的代码。
e.g.:
例如:
$foo = new Foo();
echo $foo->bar
would read as such:
是这样读的:
echo(/print) the bar property of object foo.
echo(/print)对象foo的bar属性。
It's verbose and more time consuming, but I find if there is a reason for me to be expressing my code verbally, then I probably need to be clear as to what I'm communicating exactly.
它冗长而耗时,但我发现如果我有理由口头表达我的代码,那么我可能需要弄清楚我到底在交流什么。
#10
2
The single arrow can easily be referred verbally as what it means for PHP OOP: Member. So, for $a->var
you would say "Object a's member var".
单箭头很容易被口头称为PHP OOP: Member的含义。对于$a->var你会说"对象a的成员var"
When reading code aloud, it does help to read ahead (lookahead reference, sorry), and know what you may actually be referring to. For instance, let's have the following bit of code:
当你大声朗读代码的时候,它会帮助你提前阅读(看前面的参考资料,对不起),并且知道你实际上指的是什么。例如,让我们有以下代码:
<?php
Class MyClass {
$foo = 0;
public function bar() {
return $this->foo;
}
}
$myobject = new MyClass();
$myobject->bar();
?>
So, if I were to read aloud this code block as a demonstration of code, I would say this:
所以,如果我大声读这个代码块作为代码演示,我会说:
"Define Class 'MyClass', open-brace. Variable 'foo' equals zero, terminate line. Define public function 'bar' open-close parentheses, open-brace. Return member variable 'foo' of object 'this', terminate line. Close-brace, close-brace. Instantiate new instance of 'MyClass' (no arguments) as variable object 'myobject', terminate line. Call member method 'bar' of object 'myobject', terminate line."
“定义类的MyClass’,open-brace。变量foo等于零,终止行。定义公共函数'bar'开闭括号,开括号。返回对象'this'的成员变量'foo',终止行。Close-brace Close-brace。实例化“MyClass”(无参数)的新实例为变量对象“myobject”,终止行。调用对象'myobject'的成员方法'bar',终止行。
However, if I were reading the code aloud for other students or programmers to copy without a visual, then I would say:
但是,如果我大声朗读代码,让其他学生或程序员在没有视觉效果的情况下复制,我会说:
"PHP open tag (full), newline, indent, Class MyClass open-brace, newline. Indent, ['dollar-sign' | 'Object-marker'] foo equals 0, semicolon, newline, newline. public function bar open-close parentheses, open-brace, newline. Indent, return ['dollar-sign' | 'Object-marker'] this arrow foo, semicolon, newline. Reverse-indent, close-brace, newline, reverse-indent, close-brace, newline, newline. ['dollar-sign' | 'Object-marker'] myobject equals new MyClass open-close parentheses, semicolon, newline. ['dollar-sign' | 'Object-marker'] myobject arrow bar open-close parentheses, semicolon, newline. Reverse-indent, PHP close tag."
“PHP打开标签(完整),换行,缩进,MyClass类开括号,换行。缩进,['dollar-sign' | 'Object-marker'] foo = 0,分号,换行,换行。公用功能条开闭圆括号,开撑,换行。缩进,返回这个箭头foo,分号,换行。反缩进,近支撑,换行,反缩进,近支撑,换行,换行。['美元符号' | 'Object-marker'] myobject等于新的MyClass开合圆括号,分号,换行。['dollar-sign' | 'Object-marker'] myobject箭头条开闭圆括号,分号,换行。Reverse-indent,PHP标签。”
Where you see ['dollar-sign' | 'Object-marker'], just choose whichever you tend to speak for '$', I switch between the two frequently, just depends on my audience.
当你看到['dollar-sign' | 'Object-marker'],只要选择你想说$的那个词,我就会频繁地在这两个词之间切换,这取决于我的观众。
So, to sum it up, in PHP, -> refers to a member of an object, be it either a variable, another object, or a method.
总之,在PHP中,>指的是对象的成员,它可以是变量,也可以是对象,也可以是方法。
#11
1
The senior PHP developer where I work says "arrow".
我工作的高级PHP开发人员说“arrow”。
$A->B;
When he's telling me to type the above, he'll say, "Dollar A arrow B" or for
当他告诉我输入上面的内容时,他会说“$ A arrow B”或“for”
$A->B();
"Dollar A arrow B parens."
“一美元一箭B分。”
#12
1
I would do it like this:
我会这样做:
//Instantiated object variable with the name mono call property name
$mono->name;
//Instantiated object variable with the name mono call method ship
$mono->ship();
In my book (PHP Master by Lorna Mitchell) it's called the object operator.
在我的书中(Lorna Mitchell的PHP大师),它被称为对象操作符。
#13
0
Object. So $a->$b->$c
would be 'A object B object c'.
对象。因此,$a->$b->$c将是“一个对象b对象c”。
#14
0
->
is the property operator used for PHP in objected-oriented mode.
->是在面向对象的模式中用于PHP的属性操作符。
#15
0
user187291 has answered the non-subjective question, as for the subjective one, I say "sub". For example, I would pronounce $x->y
as "x sub y" - "sub" in this context is short for "subscript". This is more appropriate for array notation; $x['y']
I also pronounce "x sub y". Typically when reading code out loud, I am using my words to identify a line the other developer can see, so the ambiguity has yet to become a problem. I believe the cause is that I view structs/objects and arrays as "collections", and elements thereof are subscripted as in mathematical notation.
user187291已经回答了非主观性问题,至于主观性问题,我说sub。例如,我将$x->y读音为“xsub - y”-“sub”在此上下文中是“subscript”的缩写。这更适用于数组表示法;$x['y']我也发“xsub - y”的音。通常在大声读代码时,我用我的词来识别其他开发人员可以看到的一行,所以这种模糊性还没有成为一个问题。我认为原因在于我把结构体/对象和数组视为“集合”,而它们的元素以数学表示法的形式被加下标。
#16
0
Japanese has a convenient particle for this, "no" (の). It is the possessive particle, meaning roughly "relating to the preceding term".
日本有一个方便的粒子,“不”(の)。它是所有格粒子,意思大致是“与前一项有关”。
"Fred の badger" means "Fred's badger".
“弗雷德の獾”意味着“弗雷德的獾”。
Which is a long way round of saying that at least mentally, and also amongst those who understand Japanese, I tend to differentiate them by reading them as:
这是很长的一段话,至少在精神上,在懂日语的人当中,我倾向于通过阅读来区分他们:
$A->B(); // "Call $A's B."
C::D(); // "Call C の D."
But reading both as a possessive "'s" works too, for non-Japanese speakers. You can also flip them and use "of", so "D of C"... but that's kinda awkward, and hard to do it you're reading rapidly because it breaks your linear flow.
但是,对于非日语的人来说,阅读这两个词都是占有的“s”。你也可以翻转它们并用of,所以D (C)但这有点尴尬,很难做到你读得很快因为它破坏了你的线性流动。
If I were dictating, though, perhaps when pair coding and suggesting what to type, I'd refer to the specific characters as "dash-greater-than arrow" and "double-colon" (if i know the person I'm talking to is a PHPophile, I might call that a "paamayim nekudotayim double-colon" the first time, partly because it's a cool in-joke, partly to prevent them from "correcting" me).
如果我是口述,不过,也许当一对编码和暗示什么类型,我指的是特定的字符“dash-greater-than箭头”和“双冒号”(如果我知道我说的人是PHPophile,我可能会称之为“paamayim nekudotayim双冒号”第一次,部分原因是它是一个很酷的开玩笑,部分是为了防止“纠正”我)。