emehrkay Posted June 19, 2006 Share Posted June 19, 2006 you know as you type along you do x equals y $x = $y;what do you say when you do this?$this->i usually say this into...does the -> have an actual name? Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/ Share on other sites More sharing options...
obsidian Posted June 19, 2006 Share Posted June 19, 2006 this may be a bit of an oversimplification, but after searching the PHP manual for a solution and coming up NULL, i figured i'd share my thoughts:i generally simply refer to it as a "pointer."i know i have to be careful, especially working with C++ programmers since it's a different animal than pointers in C, but that's my take on it. since it's not really an operator, i don't know that it has a name Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-47350 Share on other sites More sharing options...
emehrkay Posted June 19, 2006 Author Share Posted June 19, 2006 what do you say as you type it out?$this->method(); Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-47354 Share on other sites More sharing options...
wildteen88 Posted June 19, 2006 Share Posted June 19, 2006 According to [url=http://uk.php.net/manual/en/tokens.php]this page[/url] (2/3 down the page) its called the Object operator.When I type the following:$this->method();I basically say call internal function method(); Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-47367 Share on other sites More sharing options...
obsidian Posted June 19, 2006 Share Posted June 19, 2006 [quote author=wildteen88]According to [url=http://uk.php.net/manual/en/tokens.php]this page[/url] (2/3 down the page) its called the Object operator.[/quote]very good eyes, wildteen[quote author=wildteen88]When I type the following:$this->method();I basically say call interal function method();[/quote]very similar here. i usually simply say something like "Object function method()." sometimes i'll go so far as to replace "Object" with the name of the Class it belongs to, if I'm working with multiple classes that have the same function names. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-47382 Share on other sites More sharing options...
emehrkay Posted June 19, 2006 Author Share Posted June 19, 2006 cool, thanks Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-47458 Share on other sites More sharing options...
.josh Posted June 20, 2006 Share Posted June 20, 2006 [quote author=emehrkay]you know as you type along you do x equals y $x = $y;what do you say when you do this?$this->i usually say this into...does the -> have an actual name?[/quote]actually, $x = $y; means assign the value of $y to $x. it is not the same as saying $x equals $y. $x equal $y is what you'd say in a condition, like, if ($x == $y) { .. } that is, if $x equals $y. = is assignment operator.== is equalityas far as $this->blah .. if i have this:$foo->bar = 'blah';i usually say "assign 'blah' to bar of foo," or "assign 'blah' to foo's bar" That's just how i 'say' it :\ Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-47707 Share on other sites More sharing options...
emehrkay Posted February 20, 2007 Author Share Posted February 20, 2007 to i am watching a slideshow of a class given by zend on oo php and the guy says "to"$b->a"b to a" Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189865 Share on other sites More sharing options...
redbullmarky Posted February 20, 2007 Share Posted February 20, 2007 i normal say "owns" (in my head of course).not cos i'm some sort of 10 year old gaming txt spkr, but because that's how i kinda got to understand it.$this->that (this owns that, or that belongs to this)$b->a (b owns a, or a belongs to b) Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189873 Share on other sites More sharing options...
Jessica Posted February 20, 2007 Share Posted February 20, 2007 When I'm typing it, I generally call it "dot" because I started OOP with Java, and I just think to myselfclass.method()so I transfered that to php$class->method() is still class dot method to me...I guess I'm just weird. I've never had to say it out loud. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189929 Share on other sites More sharing options...
neylitalo Posted February 20, 2007 Share Posted February 20, 2007 [quote author=jesirose link=topic=96282.msg534487#msg534487 date=1172014080]When I'm typing it, I generally call it "dot" because I started OOP with Java, and I just think to myself[/quote]That's exactly what I do - I say "dot" in my mind, but my fingers make the translation from "." to "->" all on their own. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189930 Share on other sites More sharing options...
steelmanronald06 Posted February 20, 2007 Share Posted February 20, 2007 I say,this->method();this is method. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189946 Share on other sites More sharing options...
Daniel0 Posted February 21, 2007 Share Posted February 21, 2007 I never really read my code aloud, but I have sometimes wondered how I would explain some code if I had to since I do not know the names.--[quote author=redbullmarky link=topic=96282.msg534430#msg534430 date=1172008707]i normal say "owns" (in my head of course).not cos i'm some sort of 10 year old gaming txt spkr, but because that's how i kinda got to understand it.$this->that (this owns that, or that belongs to this)$b->a (b owns a, or a belongs to b)[/quote]0wn3d!!!1!!one1 Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189974 Share on other sites More sharing options...
roopurt18 Posted February 21, 2007 Share Posted February 21, 2007 I don't call it anything or translate it into any sort of phrase.Although if I did, I suppose I'd go with the following:$foo->bar = 1; ==> foo's bar equals 1$foo->bar(); ==> foo does bar Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189986 Share on other sites More sharing options...
fert Posted February 21, 2007 Share Posted February 21, 2007 I say pointer Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-189994 Share on other sites More sharing options...
dustinnoe Posted February 21, 2007 Share Posted February 21, 2007 you know your a geek when... Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-190238 Share on other sites More sharing options...
ted_chou12 Posted February 21, 2007 Share Posted February 21, 2007 what does it look like??? to me, it looks obvious like an arrow. :P Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-190326 Share on other sites More sharing options...
Stopofeger Posted February 22, 2007 Share Posted February 22, 2007 I wonder why php used this syntax as they couldv'e easily used the "." operator as all other C type langs do. Java, C#, javascript and obviously c++.Technically, "->" operator is used in c++ when accessing an object from a pointer. that is, [code] obj* obj1= &someobj;*obj->method;[/code]I don't know the internals of php. But I think "->" is used just because "." is already "married??" with string concatation. Not because php uses pointers to access objs. Ok way offtopic. I call it dot. why bother using another word. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-191223 Share on other sites More sharing options...
Jessica Posted February 22, 2007 Share Posted February 22, 2007 You answered your own question there... they can't just as easily use it because it's already being used... Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-191394 Share on other sites More sharing options...
roopurt18 Posted February 24, 2007 Share Posted February 24, 2007 I can't say why the PHP developers chose the -> operator over the dot operator, but I disagree with jesi's comment.It's not terribly difficult to have one operator that performs different operations depending on the context in which it's used. PHP already does it with LPAREN, which denotes function arguments or order of operations. C++ uses context to allow function overloading. Javascript uses the + operator for both string concatenation and arithmetic addition. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-192867 Share on other sites More sharing options...
paul2463 Posted February 24, 2007 Share Posted February 24, 2007 Personally I dont use ->but thats because I am RUBBISH and scared of classes of my own......so using Roopurt's analogy[quote]$foo->bar(); ==> foo does bar[/quote]for me it should be[quote]$I!->classes(); ==> I do not do classes[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-192874 Share on other sites More sharing options...
448191 Posted February 24, 2007 Share Posted February 24, 2007 [quote author=roopurt18 link=topic=96282.msg537457#msg537457 date=1172314033]I can't say why the PHP developers chose the -> operator over the dot operator, but I disagree with jesi's comment.It's not terribly difficult to have one operator that performs different operations depending on the context in which it's used. PHP already does it with LPAREN, which denotes function arguments or order of operations. C++ uses context to allow function overloading. Javascript uses the + operator for both string concatenation and arithmetic addition.[/quote]But then we wouldn't be able to:[code=php:0]$obj->{$foo.$bar}();${$foo.$bar}->foobar;$obj->${$foo.'bar'};[/code]String concatenation and arithmetic addition are things that can't be combined in such a way. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-192924 Share on other sites More sharing options...
448191 Posted February 24, 2007 Share Posted February 24, 2007 Of course if the php string concatenation operator where to change to the plus sign:[code=php:0]$obj.{$foo+$bar}();${$foo+$bar}.foobar;$obj.${$foo+'bar'};[/code] ::) Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-192930 Share on other sites More sharing options...
ober Posted February 24, 2007 Share Posted February 24, 2007 I personally say "calls"... $dog->bark(); So in my head, I say "dog calls bark". When I'm referencing a class variable "$dog->poop = yellow" I just simply say dog poop equals yellow... I personally think it differs depending on whether you're referencing a variable or a method/function. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-192984 Share on other sites More sharing options...
roopurt18 Posted February 24, 2007 Share Posted February 24, 2007 [quote author=448191 link=topic=96282.msg537515#msg537515 date=1172326465]But then we wouldn't be able to:[code=php:0]$obj->{$foo.$bar}();${$foo.$bar}->foobar;$obj->${$foo.'bar'};[/code][/quote]Not so.[code]<?php$obj->{$foo.$bar}();// Would become...$obj.{$foo.$bar}();?>[/code]If $foo is an object, we mean the property of $foo indicated by the variable $bar. If $foo is not an object, we mean string concatenation, since there is no LPAREN after $bar.If $obj is an object, we mean to call the method of $obj named after the concatenation of the variables $foo and $bar. If $obj is not an object, we mean to concatenate the contents of $obj with the results of the function named after the concatenation of the variables $foo and $bar.[code]<?php${$foo.$bar}->foobar;// Would become${$foo.$bar}.foobar;?>[/code]If $foo is an object, we mean the property of $foo indicated by the contents of $bar. If $foo is not an object, we mean string concatenation of $foo and $bar since $bar has no trailing LPAREN.If the variable named for the result of the curly bracket expression is itself an object, we mean the foobar property of that object, otherwise you have a syntax error (expected T_DOLLAR_SIGN before 'foobar').[code]<?php$obj->${$foo.'bar'};// Would become$obj.${$foo.'bar'};?>[/code]If $foo is an object, it is converted to the string 'object' and concatenated with 'bar'. This is done because 'bar' is not a legal identifier. Otherwise the contents of $foo are concatenated with 'bar'.If $obj is an object, we mean the property contained within the variable named by the curly bracket expression. If $obj is not an object, we mean string concatenation. Quote Link to comment https://forums.phpfreaks.com/topic/12379-how-do-you-say/#findComment-193079 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.